Are you facing the challenge of handling online transactions? Rapyd provides a robust and reliable solution through our Collect API, which lets you accept payments from many global payment methods. In this article, we’ll walk you through how you can utilize the Rapyd Collect API to accept payments for an enterprise-level customer.
Understanding the Rapyd Collect API
The Rapyd Collect API is a powerful tool that lets businesses accept payments from customers across the globe. It supports various payment methods, including credit cards, bank transfers, eWallets, and cash. This diverse range of options makes it easier for your enterprise customers to do business with you, no matter where they are or how they prefer to pay.
Accepting a Payment with Rapyd Collect API
Let’s look at how to accept a payment using the Rapyd Collect API.
Step 1: Create a Payment
To start, you’ll need to create a payment. In the API call, you’ll specify the payment method, the amount, and the currency. Here’s an example of what that API call might look like in code:
import requests
url = "https://sandboxapi.rapyd.net/v1/payments"
headers = { 'Content-Type': 'application/json' }
body = {
"amount": 100.00,
"currency": "USD",
"payment_method": {
"type": "us_mastercard_card"
},
// Additional fields here...
}
response = requests.post(url, headers=headers, json=body)
payment = response.json()
This code sends a request to Rapyd’s server to create a new payment. The server will respond with a payment object, including all the payment details.
Step 2: Confirm the Payment
Once you have created a payment, the next step is to confirm it. This is important because it ensures the payment details are correct before processing the transaction. You’ll make another API call to do this, passing in the ID of the payment you just created.
url = "https://sandboxapi.rapyd.net/v1/payments/{payment['id']}/complete"
response = requests.post(url, headers=headers)
confirmed_payment = response.json()
Once the payment is confirmed, Rapyd will process the transaction.
Step 3: Check the Payment Status
After processing the payment, you’ll want to check the status to ensure it was successful. You can do this with another API call.
url = "https://sandboxapi.rapyd.net/v1/payments/{confirmed_payment['id']}"
response = requests.get(url, headers=headers)
payment_status = response.json()['status']
If the payment is successful, the status will be ‘COMPLETED.’
Conclusion
The Rapyd Collect API simplifies the complex process of accepting international payments, making it easier for your business to reach enterprise customers worldwide. By creating, confirming, and checking the status of a payment, you can securely handle transactions and foster trust with your customers.
Please delve into our official documentation for more in-depth information on Rapyd’s Collect API.
So, next time you’re looking for a solution to handle global payments, why not give the Rapyd Collect API a shot?