Skip to main content
POST
/
account
/
payments
/
payfast
/
setup
Create PayFast setup identifier
curl --request POST \
  --url https://api.marzipan.co/v1/account/payments/payfast/setup \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "subscriptionId": "c3d4e5f6-7890-a1b2-c3d4-e5f607182930"
}
'
import requests

url = "https://api.marzipan.co/v1/account/payments/payfast/setup"

payload = { "subscriptionId": "c3d4e5f6-7890-a1b2-c3d4-e5f607182930" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({subscriptionId: 'c3d4e5f6-7890-a1b2-c3d4-e5f607182930'})
};

fetch('https://api.marzipan.co/v1/account/payments/payfast/setup', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.marzipan.co/v1/account/payments/payfast/setup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subscriptionId' => 'c3d4e5f6-7890-a1b2-c3d4-e5f607182930'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.marzipan.co/v1/account/payments/payfast/setup"

payload := strings.NewReader("{\n \"subscriptionId\": \"c3d4e5f6-7890-a1b2-c3d4-e5f607182930\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.marzipan.co/v1/account/payments/payfast/setup")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscriptionId\": \"c3d4e5f6-7890-a1b2-c3d4-e5f607182930\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.marzipan.co/v1/account/payments/payfast/setup")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriptionId\": \"c3d4e5f6-7890-a1b2-c3d4-e5f607182930\"\n}"

response = http.request(request)
puts response.read_body
{
  "identifier": "b1234567-89ab-cdef-0123-456789abcdef",
  "engineUrl": "https://sandbox.payfast.co.za/onsite/engine.js"
}
{
"message": "Unauthenticated."
}
{
"error": "Subscription not found"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is the account token returned from the Login endpoint.

Body

application/json
subscriptionId
string<uuid>

Optional subscription to link the new payment method to

Response

Success

identifier
string
engineUrl
string