Payment Actions
Capture a Preauth
Call Payment/CapturePayment with parameters
- merchantId
- paymentId - id of payment to capture
- amount - amount to capture
- finalAmount - whether this is final - ie no further preauth possible
Note
- Debit cards typically have a lifetime of 7 days, and credit cards typically ahve a lifetime of 30 days
- Not all underlying providers support split authorisations
request:
curl -X 'POST' \
'https://api.dev.paylolly.app/api/rest/v1.0/Payment/CapturePayment' \
-H 'accept: application/json' \
-H 'MerchantKey: 35236fcf-12f4-4c94-b4ba-5d236457b68a' \
-H 'Content-Type: application/json' \
-d '{
"merchantId": "dbdab964-82ee-4b09-a26b-68403c31afa7",
"paymentId": "9ce92b5a-a71f-40b9-b204-76c4390512f0",
"amount": 1,
"finalAmount": true
}'
response:
{
"paymentId": "9ce92b5a-a71f-40b9-b204-76c4390512f0",
"processorCaptureId": "e3604cd6-1d17-422c-9c48-89ef7caab89a"
}
Refund a Payment
Call Payment/RefundPayment with parameters
- merchantId
- paymentId - id of payment to refund
- amount - amount to refund
Note
- Refunds are limited to not exceed original amount
- Not all providers support split refunds
- Not all providers support partial refunds
request:
curl -X 'POST' \
'https://api.dev.paylolly.app/api/rest/v1.0/Payment/RefundPayment' \
-H 'accept: application/json' \
-H 'MerchantKey: 35236fcf-12f4-4c94-b4ba-5d236457b68a' \
-H 'Content-Type: application/json' \
-d '{
"merchantId": "dbdab964-82ee-4b09-a26b-68403c31afa7",
"paymentId": "9ce92b5a-a71f-40b9-b204-76c4390512f0",
"amount": 1
}'
response:
{
"paymentId": "9ce92b5a-a71f-40b9-b204-76c4390512f0",
"processorRefundId": "c2f1cfb1-c814-4ec7-85a5-874723896e15"
}
Cancel a Hosted Payment
If hosted payment was not already completed, it can be cancelled through api call Payment/CancelPayment
- merchantId
- paymentId - id of payment to cancel
Void a Payment
Call Payment/VoidPayment with parameters
- merchantId
- paymentId
- processorId
Note
- Not all providers support all voids
- Supply processorId returned on original transaction to ensure appropriate transaction is voided
Repeated Payment (MIT)
For autmated payments initiated by merchants (MIT - Merchant Initiated Transaction)
- Initial payment must be flagged CIT
- Initial payment must be flagged with recurrence not OneTime - OneClick is the registering payment (hosted, async or sync); on hosted and async it can carry an
agreementobject - 3D secure of initial payment must have appropriate Recurring parameters
- Initial payment once approved, store paymentId, accountId, token, and traceId - and the agreementId when the payment carried an agreement (it is in the payment status and the webhooks)
Automated payments are to be created using CreateSyncPayment
- fill merchantId
- fill accountId (from initial)
- fill currency
- fill amount
- fill merchantRef (unique - suggest guid)
- fill tokenData (token and traceId from initial) - the traceId may be left out when you send the agreementId, it is then taken from the agreement
- optionally fill agreementId (from the registering payment): the trace id and processor references of that agreement are used instead of the token's. Needed when one card has several agreements and you want the payment made under a particular one. It must belong to your merchant and the token (
AGR08otherwise) - fill authorisationType - typically AuthCapture
- fill recurrence - Recurring (if scheduled) or Unscheduled (if unscheduled) - nothing else is valid for a MIT
- webhooks typically not required for sync payments
- set initiation to MIT
Warning
A merchant initiated payment with recurrence OneClick or OneTime is rejected with VAL08. Recurrence OneClick is only for the registering payment (customer present, initiation CIT). See Sync Payment for all combinations.
Note
A payment is never rejected because the agreement is cancelled or expired: it is counted and processed. Not initiating payments under a cancelled agreement is your responsibility.
request:
curl -X 'POST' \
'https://api.dev.paylolly.app/api/rest/v1.0/Payment/CreateSyncPayment' \
-H 'accept: application/json' \
-H 'MerchantKey: 35236fcf-12f4-4c94-b4ba-5d236457b68a' \
-H 'Content-Type: application/json' \
-d '{
"merchantId": "dbdab964-82ee-4b09-a26b-68403c31afa7",
"currency": "EUR",
"amount": 1,
"merchantRef": "9e31818e-407b-48d8-8bbe-eb19fa565733",
"tokenData": {
"token": "830DAE88123E8DD3DEF9658E846F97C2",
"traceId": "0102030405060708090A0B0C0D0E0F"
},
"agreementId": "0198ab5c-6f37-7a02-9d7e-3a5e2c1f4b10",
"authorisationType": "AuthCapture",
"recurrence": "Unscheduled",
"initiation": "MIT"
}'
response:
{
"paymentId": "cd154ad8-2654-4c91-93b9-d8a61c13787d",
"merchantId": "dbdab964-82ee-4b09-a26b-68403c31afa7",
"accountId": "81de44cb-4b70-4207-9f5e-54355491a5cc",
"currency": "EUR",
"amount": 1,
"cardData": {
"maskedPAN": "400000*0002",
"expiryYYMM": "2212",
"token": "830DAE88123E8DD3DEF9658E846F97C2"
},
"threeDSData": null,
"result": {
"status": "Approved",
"processorId": "437d8efe-aaf1-4455-b6f9-e62b32b47c1b",
"message": "Dummy success",
"authCode": "123456",
"traceId": null,
"standardHostCode": null,
"mastercardMacCode": null
},
"merchantRef": "9e31818e-407b-48d8-8bbe-eb19fa565733"
}