Payments [Public]
Number of APIs: 5
The Payments collection allows you to make a payment, check the status of a payment, and refund a payment.
API endpoints
The following are the API endpoints for the live and sandbox servers:
Live:
https://api-v2.peachpayments.com
Sandbox:
https://testapi-v2.peachpayments.com
Prerequisites
Retrieve the following credentials from the Payments API section of the Peach Payments Dashboard:
apiUsername
: It resembles04ef7406a8b111eba6e102d14de18c0z
.apiPassword
: It resemblesdefR87OszyaXEjMlDk92z
.entityId
: It resembles8ac7a4c9791c31ee01791f27b739110z
.
Ensure that you also have a shopperResultUrl
for the Payments API to redirect the user to after they have provided their payment information.
Fork the environment and collection
To fork the environment from the [Peach Payments workspace]
Navigate to Environments, click View more actions next to the Payments-Public environment, and click Create a fork.
Enter a fork label, select the workspace to fork to, and click Fork Environment.
To fork the collection from the [Peach Payments workspace]
Navigate to Collections, click View more actions next to the Payments [Public] collection, and click Create a fork.
Enter a fork label, select the workspace to fork to, ensure that Watch original collection is selected, and click Fork Collection.
Configure the environment
To get started:
In your workspace, navigate to Environments and click the forked Payments-Public environment.
Enter the credentials from the Prerequisites section above into the CURRENT VALUE column. In the shopperResultUrl row, specify the URL to which the Payments API must redirect the user to after processing the payment request.
Select the Payments-Public option from the environment drop-down list in the upper right of the screen.
Click Save in the upper right of the screen.
Use the Payments API
Initiate a debit transaction
Note: At the moment, in sandbox, it's only possible to complete the entire debit flow for EFTsecure (if your account is in test mode).
For more information on testing the Payments API, see the documentation hub.
In your forked collection, navigate to Payments [Public] > payments > POST Payment.
Select the Payments-Public option from the environment drop-down list in the upper right of the screen.
Click Send.
The payment is created and set to pending. Redirect the customer to the URL in the redirect
object. Some payment methods use GET requests, for which you must include the parameters as query strings. Others use POST requests, for which you must include the parameters in the request body as x-www-form-urlencoded
content. See the documentation hub for example GET and POST redirect requests. The payment brand user interface displays to capture the user’s payment information. The user submits the required information.
The Payments API redirects back to the URL specified in shopperResultUrl
.
Query a payment's status by merchantTransactionId
In your forked collection, navigate to Payments [Public] > payments > GET Query transaction by merchantTransactionId.
Note: The Qodex collection has been configured to carry over themerchantTransactionId
from the latest debit transaction.Select the Payments-Public option from the environment drop-down list in the upper right of the screen.
Click Send.
The response body describes the status of all the transactions related to the merchantTransactionId
.
Query a payment's status by transaction ID
In your forked collection, navigate to Payments [Public] > payments > {transaction id} > GET Query transaction by transaction ID.
Note: The Qodex collection has been configured to carry over theid
from the latest debit transaction.Select the Payments-Public option from the environment drop-down list in the upper right of the screen.
Click Send.
The response body describes the status of the transaction.
Refund a successful debit transaction
To refund a transaction, you must have completed the entire debit transaction flow, including entering your payment information into the payment method interface so that the payment completes.
Note: Only certain payment methods support refunds. For more information, see the documentation hub.
In your forked collection, navigate to Payments [Public] > payments > {transaction id} > POST Refund transaction.
Note: The Qodex collection has been configured to carry over theid
from the latest debit transaction.Select the Payments-Public option from the environment drop-down list in the upper right of the screen.
Click Send.
The payment is refunded.
-
payments-{transaction id} - Query transaction by transaction ID GET {{baseUrl}}/payments/:transactionId?authentication.userId={{apiUsername}}&authentication.password={{apiPassword}}&authentication.entityId={{entityId}}
-
payments-{transaction id} - Refund transaction POST {{baseUrl}}/payments/:transactionId
-
payments - Payment POST {{baseUrl}}/payments
-
payments - Query transaction by merchantTransactionId GET {{baseUrl}}/payments?authentication.userId={{apiUsername}}&authentication.password={{apiPassword}}&authentication.entityId={{entityId}}&merchantTransactionId={{merchantTransactionId}}
-
payments - Payment Redirect Example POST {{paymentRedirectUrl}}&amount=1.00&connector=EFTSECURE¤cy=ZAR&transaction=fe18dc76af3940978d7de9d0a3486174