The client object contains a field under urls called payment. If the relevant client where to visit this URL they can make a payment without logging in first.
When redirecting a client to this URL one can optionally specify the URL parameter redirect_url. The client is then redirected back to the redirect URL when the client has made a payment or updated their payment method to something which requires you to process their payment.
Parameter | Description |
---|---|
transaction_uuid | A uuid for the transaction. A new UUID is created each time the client visits the payment URL. |
cancel_url | Optional The URL specified to redirect to if payment is cancelled. |
redirect_url | Optional The URL specified to redirect to after payment is completed. |
success-heading | A heading for the success message |
success-message | A message indicating the state of the payment |
payment_method_code | The code for the payment method used by the client |
redirect | The URL specified to redirect to. |
payment_id | Optional id of the payment if one was created with the signup |
payment_state | Optional state of the payment (either paid, or pending) |
payment_amount | Optional amount of the payment as measured as a floating point value |
signature | A signature using a shared secret confirming that the above fields were not tampered with |
Say the payment URL for a client is https://demo.snapbill.com/payment/client/FoE:A/GIQ56fGwX05z. After adding an invoice for the client through the API, you can redirect them to https://demo.com/success/FoE:A by sending the client to https://demo.snapbill.com/payment/client/FoE:A/GIQ56fGwX05z?redirect=https%3A%2F%2Fdemo.com%2Fsuccess%2FFoE%3AA.
An example of the variables POSTed to the redirect URL is below:
[payment_amount] => 476 [payment_id] => 30 [payment_method_code] => payfast [payment_state] => pending [redirect] => https://demo.com/success/FoE:A [success-heading] => Your payment has been processed [success-message] => Your payment is marked as pending. We are still awaiting confirmation from PayFast, but as soon as that is received your invoices will be marked as paid. [transaction_uuid] => OWI0ZWU3ZTktYTNkYi00NGYyLWEzZWEtZWZhOWVmMzRlZGQx [signature] => yynYkjNvYyrMnS1wmItMa5pZhyEjtirgRM1UZ6fN6a0=
In the case of a payment method which requires you to process the payment, the variables passed back won't include the payment:
[payment_method_code] => other [redirect] => https://demo.com/success/FoE:A [success-heading] => Your payment details have been updated [success-message] => Thank you for updating your payment details [transaction_uuid] => MTA1OGRhNTItMTZlYi00YWI1LWFiMjgtNjJlMTU0N2Y3Yjc1 [signature] => dUOawxjoHyzg9xq9t2ZCcaspIbkEVpqPKKJnqkkdTWY=