OP Online payment actions via eComm API
Overview
This tutorial will help you understand how the OpOnlinePayment eComm API works and how to perform your first transaction through the eComm API with Verifone.
Prerequisites
Before making a transaction, you need:
- A Verifone Sandbox account.
- To obtain an API key.
- The Payment Provider Contract ID associated with your OpOnlinePayment connection as part of your onboarding into Verifone Central.
Create a transaction
Make a POST request to /transactions/op-online-payment
endpoint. Here is an example of a payload:
curl --location 'https://cst.test-gsc.vfims.com/oidc/api/v2/transactions/op-online-payment' \
--header 'Authorization: Basic [REPLACE_WITH_YOUR_CREDENTIALS]' \
--header 'Content-Type: application/json' \
--data '{
"amount": 3,
"payment_provider_contract": "[YOUR_PPC]",
"currency_code": "EUR",
"return_url": "https://[YOUR_SUCCESS_URL]",
"reject_url": "https://[YOUR_SUCCESS_URL]",
"cancel_url": "https://[YOUR_SUCCESS_URL]",
"bank_id": "BankoEnablado",
"language": "en",
"merchant_reference": "1301"
}'
Response example:
{
"amount": 3,
"status": "INITIATED",
"id": "27b74438-6e38-4d7a-a064-aeb024177c28",
"payment_url": "https://api.smn-sandbox.aws.op-palvelut.fi/customer/payment/multibank/direct/BankoEnablado/startPaymentConfirmation?paymentOperationId=18e51512-a2b8-4c4f-908e-d9c2cc19c8b5d33a3e35-11b4-4b7d-8762-4959f3eda5s4&paymentOperationValidation=Y1gGm5LcKnvs9Ge2TPGD6mkwFaAz86cRoUj40VzmIdM%3D",
"processor": "OP_ONLINE_PAYMENT",
"payment_product": "OP_ONLINE_PAYMENT"
}
For details about the API reference and the request fields, you can review the Create Transaction API.
Redirect the shopper to complete payment
Use the payment_url
in the response to redirect the shopper to complete the payment.
Handle the Success callback
When the shopper is returned to the return_url
that you specified in the transaction API call, do a eComm-api transaction lookup to check the transaction status.
curl --location --request GET 'https://cst.test-gsc.vfims.com/oidc/api/v2/transaction/27b74438-6e38-4d7a-a064-aeb024177c28' \
--header 'Authorization: Basic [REPLACE_WITH_YOUR_CREDENTIALS]'
Response example:
{
"id": "27b74438-6e38-4d7a-a064-aeb024177c28",
"amount": "0.03",
"currency_code": "EUR",
"created_at": "2024-04-10T14:08:04.307Z",
"country_code": "FI",
"shipping_information": {},
"customer_details": {
"language": "en",
"billing": {},
"shipping": {}
},
"status": "SALE SETTLED",
"processor_reference": "b8e51512-a2b8-4c4f-908e-d9c2cc19c8b5",
"cvv_present": false,
"shopper_interaction": "ecommerce",
"merchant_id": "230729",
"payment_summary": {
"captured_amount": "0.03"
},
"transaction_status": "SETTLED",
"transaction_type": "SALE"
}
For details about the API reference and the request fields, you can review the get transaction API documentation.
Refund a transaction
Make a POST request to /transactions/[transaction-id]/refund
endpoint. Here is an example of a payload:
curl --location 'https://cst2.test-gsc.vfims.com/oidc/api/v2/transactions/8cf78a91-8307-46e3-bd75-0c9742cd945d/refund' \
--header 'x-vfi-api-idempotencyKey: ffdda80d-8f19-4fd2-817d-255345611386' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic [REPLACE_WITH_YOUR_CREDENTIALS]'' \
--data '{
"amount": 1.00,
"reason": "test op refund"
}
Response example:
{
"id": "e0b54800-3453-4162-948a-68bec217056c",
"amount": 100,
"created_at": "2024-04-11T11:54:14.913120155Z",
"merchant_reference": "Ref-2024-04-11-13.51.15",
"payment_product": "OP_ONLINE_PAYMENT",
"payment_product_type": "OP Online Payment",
"processor": "OP_ONLINE_PAYMENT",
"processor_transaction_id": "1673ea06-114d-419d-80ea-5ef81a679514",
"status": "REFUNDED",
"reversal_status": "NONE",
"cvv_result": "0"
}