1. Get AUTH token
POST: {{auth_url}}/client/access_token
You will need these following parameters (JSON format)
{
"grant_type": "client_credentials",
"client_id": "",
"client_secret": "",
"scope": "payments"
}
Client_id and client_secret are like username and password, I can provide them later on.
The response is similar to this:
{
"token_type": "Bearer",
"expires_in": 3600,
"access_token": "ey..."
}
This token is to be used as an Auth bearer token in the header throughout this part. I saved this as {{auth_token}} for future reference
2. Get a PAYMENT token
POST: {{base_url}}//{{MerchantID}}/Token/
This step is to generate a unique payment token for this user.
The body (json) will have something similar to this:
{
"FirstName": "",
"LastName": "",
"Email": "",
"Mobile": "",
"Address1": "",
"Address2": "",
"Suburb": "",
"State": "",
"Postcode": "",
"Country": "",
"Billing": {
"Type": "",
"Reference": ""
}
}
This is the info you need to acquire from Magento checkout.
The response is something like this:
{
"Token": "..."
}
I saved this as {{payment_token}} for future reference
3. Register a CARD
POST: {{base_url}}/{{MerchantID}}/Token/{{payment_token}}
After you acquired a unique payment token, you have to register a card to this payment token.
The body is something like this:
{
"Integration": "Standard",
"URL": {
"Success": ".../success/",
"Failure": ".../failure/"
}
}
This post request will always return a paymentURL like following:
{
"Token": "...",
"paymentURL": "..."
}
The paymentURL page is a credit card form where the user can enter his card details.
When we have the paymentURL, we can have that opened in a separate window (or same window) that when completed will return to either success or failure on Magento.
To my understanding, the response will be in the $_POST to these return URLs. You might need to do some investigating here to find out what's returned.
The failure URL would be something like going back to Magento checkout and display the error message.
The success URL would be Magento moving to next step., which is to create a transaction.
I'll also include the step where we can verify a card and see if it's success / failure
4. Verify a CARD
GET: {{base_url}}/{{MerchantID}}/Token/{{payment_token}}
After registering a card, we can verify if the card is registered properly.
Sample response for registering card - success:
{
"Token": "...",
"Card": {
"Type": "...",
"Brand": "...",
"Number": "......",
"Name": "...",
"Month": "...",
"Year": "...",
"IssuingBank": "...",
"Country": "..."
}
}
Sample response for registering card - failure:
{
"Error": true,
"Type": "SYSTEM_NOTREGISTERED",
"Detail": "transaction declined (invalid CVV)"
}
5. Create a TRANSACTION
POST: {{base_url}}/{{MerchantID}}/Transaction/
If the card was registered successfully, we can continue on to create a transaction with the amount we want to charge (from the Magento order).
Sample request body (json):
{
"Token": "{{payment_token}}",
"Amount": "0.01",
"Currency": "...",
"BillingAddress": {
"Address1": "",
"Address2": "",
"Suburb": "",
"State": "",
"Postcode": "",
"Country": "..."
}
}
The Payment token is required. The rest of the details can be acquired from Magento order.
Note that country is ISO 2 digit (2 letters)
Sample response:
{
"Token": "...",
"Transaction": "...",
"Reference": "...",
"Amount": ...,
"Currency": "...",
"Status": "FAILED",
"Detail": "CARD_DECLINED"
}
If there was an error, response would be something like this:
{
"Error": true,
"Type": "VALIDATION_TOKEN",
"Detail": "Token Not Found"
}
I’m a certified Magento expert and I have a team here with 6 Magento1 and Magento2 certified developers.
I can start your project quickly.
Kindly give me a message to discuss further.
Regards
Paul Simon
Hi, Alan
I have read your project description very carefully, I can integrate the payment as your request.
Can you provide me API document url, too?
I am ready for your project and I will provide the best service for you.
Please feel free to contact me.
Hope to be working with you
Hello Monali here,
I have checked your job description carefully and I keep to get an opportunity to work with you.
I have over 4+ years of experience in Magento Theme & Plugin Development & customisation.
I can start work on your project on the spot and can give your work with good quality.
Thanks