Generate Payment Key
Send the request parameters server-to-server to prepare the payment key
Create the payment form
Display the payment form on your checkout page and the shopper submits the payment
Get the payment status
Find out if the payment was successful.
How it works
COPYandPAY
1. Prepare the checkout
First, perform a server-to-server POST request to prepare the checkout with the required data, including the order type, amount and currency. The response to a successful request is a JSON string with an id, which is required in the second step to create the payment form.
curl https://test.letswhoosh.co.za/v1/checkouts \
-d “entityId=8a8294185a184b44015a18be521a02b0” \
-d “amount=92.00” \
-d “currency=ZAR” \
-d “paymentType=DB” \
-H “Authorization: Bearer OGE4Mjk0MTg1YTE4NGI0NDAxNWExOGJlNTI2YzAyYjR8Nk1XRGo3azg1OQ==“
2. Create the payment form
Confidential customer information is encrypted and protected from any potential fraud occurrence.
<form action=”{shopperResultUrl}” class=”paymentWidgets” data-brands=”VISA MASTER AMEX”></form>
3. Get the payment status
Once the payment has been processed, the customer is redirected to your shopperResultUrl along with a GET parameter resourcePath.
resourcePath=/v1/checkouts/{checkoutId}/payment
How it works
Server-to-Server
curl https://test.letswhoosh.co.za/v1/payments \
-d “entityId=8a8294185a184b44015a18be521a02b0” \
-d “amount=92.12” \
-d “currency=ZAR” \
-d “paymentBrand=GIROPAY” \
-d “paymentType=DB” \
-d “bankAccount.bic=TESTDETT421” \
-d “bankAccount.iban=DE14940593100000012346” \
-d “bankAccount.country=DE” \
-d “shopperResultUrl=https://docs.letswhoosh.co.za/tutorials/server-to-server” \
-H “Authorization: Bearer OGE4Mjk0MTg1YTE4NGI0NDAxNWExOGJlNTI2YzAyYjR8Nk1XRGo3azg1OQ==“
1. Send an Initial Payment
First, perform a server-to-server POST request to prepare the checkout with the required data, including the order type, amount and currency. The response to a successful request is a JSON string with an id, which is required in the second step to create the payment form.
<form action=“{redirectUrl}” class=“paymentWidgets”>
<input type=“text” name=“{name-1}” value=“{value-1}”>
…
<input type=“text” name=“{name-2}” value=“{value-2}”>
</form>
2. Redirect the shopper
The next step is to redirect the account holder. To do this you must parse the redirect object, that contains a url, parameters and optionally a method. If the method is set, it will be set to either GET or POST. If GET, you should append any parameters to the url. If POST, you send HTTP POST the parameters to the URL. If the method is not sent, you should default to POST.
resourcePath=/v1/payments/{id}
3. Get Payment Status
Once the payment has been processed, the customer is redirected to your shopperResultUrl along with a GET parameter resourcePath.