Payment flow summary
Step 1: Generate signature
After you have collected all relevant transaction information, you need to generate and add a signature to your request for authentication. The signature uses the HMAC SHA256 algorithm and all the payment parameters in the request. The secret token provided to you by Peach Payments acts as the key to generate the signature.
For more details on how to generate the signature, see the Authentication and authorisation section.
Step 2: Initialise Checkout and redirect customer
After you have generated the signature, you can initialise Checkout using your request parameters and signature and redirect the user to the payment page using one of the following methods:
- Redirect
- Form POST
Redirect-based Checkout
Execute the redirect-based Checkout call and redirect the user to the returned URL.
Form POST Checkout
Execute the Checkout call and use a form POST to redirect the user to the payment page:
<!doctype html>
<html>
<body>
<form name="form" action="https://testsecure.peachpayments.com/checkout" method="POST" accept-charset="utf-8">
<input type="hidden" name="amount" value="2" />
<input type="hidden" name="authentication.entityId" value="8ac7a4ca68c22c4d0168c2caab2e0025" />
<input type="hidden" name="currency" value="ZAR" />
<input type="hidden" name="merchantTransactionId" value="TESTING002" />
<input type="hidden" name="nonce" value="Test1234" />
<input type="hidden" name="paymentType" value="DB" />
<input type="hidden" name="shopperResultUrl" value="https://webhook.site/4e9b63bf-0d99-4d62-bd24-1d36ca866e1b" />
<input type="hidden" name="signature" value="311ed8e11e2da00d98c7479ca390a5396fe643e13629d850243dada877963afd" />
<input type="submit" value="Continue to Payment Method"/></form>
</body>
</html>
Step 3: Query payment status
After payment processing completes, Checkout redirects the customer to your shopperResultUrl
. That redirect is a POST request which has the same structure as that of the webhook. You can make a request to get the status of a Checkout payment request by using the checkoutId
parameter as a reference to the payment.
The webhook notification and the POST redirect to the shopperResultUrl
include the checkoutId
.
API endpoint
The API base URL for querying the payment status differs from that of payment initiation in step 2 above. This API forms part of the Peach Payments back office APIs.
import requests
url = "https://testsecure.peachpayments.com/status?authentication.entityId=8ac7a4c8708b8dae01708be6bb3b018e&merchantTransactionId=ffghfsdrererwsdsf&signature=99699bb4a04af65a762ec4d15363a3d79aa21a12786721e0e89fa6c98933fb18"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location --request GET 'https://testsecure.peachpayments.com/status?authentication.entityId=8ac7a4c8708b8dae01708be6bb3b018e&merchantTransactionId=ffghfsdrererwsdsf&signature=99699bb4a04af65a762ec4d15363a3d79aa21a12786721e0e89fa6c98933fb18'
Updated 22 days ago