Skip to main content

Payment

Endpoint Info

METHODURL
POST/orders/{orderId}/pay
EXAMPLEhttps://test.api.macropay.com/v2/orders/{orderId}/pay

Overview

The payment form of the Revup SDK gathers all required information to call this endpoint automatically on submit, therefore you only need to send requests to it when charging recurring payments with a token. For the latter case, you need to provide the order ID generated in the previous step as a path parameter, the token ID generated in the initial recurrence within the data attribute and the paymentMethod attribute set to credit_card_token (it must have always that value for recurring payments).

For the latter case:

  • Provide the order ID generated in the previous step as a path parameter
  • Provide the token ID generated in the initial recurrence within the data attribute
  • Set the paymentMethod to credit_card_token (it must have always that value for recurring payments)

The payment form of the Revup SDK also manages the returned API response. However you will need to do it yourself for merchant initiated transactions. The response of this endpoint indicates the associated transaction ID, transaction status, message and / or error. There are 4 possible statuses, and depending on the payment being synchronous, asynchronous or requiring 3DS authentication, the retrieved status could not be the final. Be aware that a 200 API response does not mean the payment was successful, it only means that Revup was able to process your request and forward it to the provider. However a non-200 API response always means the payment has failed.

warning
  • A 200 response means Revup processed the request and forwarded it to the provider, not that the payment was successful.
  • A non-200 response means the payment failed.

3DS Payments Behavior

When payments undergo a 3DS process, they are always managed asynchronously, meaning that their first reported status will be either in_process or waiting_user_interaction:

Status: in_process

Status: waiting_user_interaction

  • The transaction will contain an action object. It holds the required parameters to perform the 3DS process: mainly the HTTP method and URL to redirect the user to the challenge, and optionally the headers and additional parameters that some providers require (the method and data for the challenge request depends entirely on the PSP and not on Revup). Once the user completes that step, they will be redirected to the URL provided in the order or to the default URL in the merchant configuration.

If the payment does not reach a final status, Revup will handle resolution via supplier status polling.


Request Body Example – Perform Payment

{
"data": "43d2c921-2cba-49a6-aada-c80c37362dc3",
"paymentMethod": "credit_card_token"
}

SUCCESS RESPONSES - PERFORM PAYMENT

HTTP CODEDESCRIPTION
200Response contains the transaction ID, the success status and the message “The payment has been processed successfully” in JSON format. It means the connection with the issuer and the payment were successful.
200Response contains the transaction ID, the failed status and the message “The payment has failed” in JSON format. It means the connection with the issuer was successful but the payment was not processed or the authentication information was not enough or invalid. In this case, a more specific message will be sent through the callback to redirectURL.
200Response contains the transaction ID, the in_process status and the message “The payment is being processed” in JSON format. It means the connection with the issuer was successful but the final payment status is not known yet.
200Response contains the transaction ID, the waiting_user_interaction status, the action object and the message “The payment is being processed” in JSON format. It means the connection with the issuer was successful but it requires the user to be redirected to a 3DS challenge.

Success Response Example – Perform Payment

{
"transactionStatus": "waiting_user_interaction",
"message": "The payment is being processed",
"transactionId": "433296ec-a1cd-47b3-bf3a-db87d5926262",
"action": {
"url": "https://www.redirect-url-domain.es",
"method": "POST",
"headers": [
{
"key": "authReq",
"value": "YYYYXXXX"
},
{
"key": "headerReq",
"value": "AAAXXYYYYZZZZZ"
}
],
"parameters": [
{
"key": "connector",
"value": "THREEDSECURE"
},
{
"key": "PaReq",
"value": "XXXXYYYYZZZZZ"
}
]
},
"version": 2
}

Error Responses

HTTP CODEERROR CODEERROR MESSAGEDESCRIPTION
4000905Problem Parsing RequestThe request syntax is incorrect.
4000300Invalid RequestThe request body does not match the JSON schema, the order ID is not an UUID, the token is not valid or the decoded ciphered data has not some required field / has unexpected or invalid parameters.
4000108Transaction Not FoundThe order does not exist nor has it been processed. It might be created but also expired.
4000906Request Already ProcessedOrders can only be processed once, if it was already used a new order must be created.
4000303Invalid Card NumberThe card number might be written incorrectly, maybe with hyphens and / or spaces.
4000306Invalid Cardholder NameThe cardholder name must be provided.
4000309Invalid CVVThe value should be a number of three or four digits.
4000310Invalid Expiry DateThe card month and year must represent a valid date above the current one.
4000312Missing or Invalid DataThe requested payment has invalid or missing data. Remember that the credit card token method is only valid to pay recurrences or consumer initiated payments and the credit card ciphered data method only allows credit card payments or initial recurrences.
4000150Recurring Data Reference Not AvailableA recurring or final recurrence requires a parent transaction ID indicated in the order belonging to a successful initial recurrence which is not associated with any final recurrence.
4000151Token Not FoundThe provided token does not exist in the system.
4000204Expired CardThe credit card related to the token has an expired expiration date.
4000907Configuration Error - MID RequiredThere is not a correctly configured MID for these parameters.
403-User is not authorized to access this resource with an explicit denyThis response is returned when the user is not authorized to access to this resource
5000900Internal Server ErrorThe server experienced an unexpected error.

Error Response Example – Perform Payment

{
"transactionStatus": "failed",
"error": {
"code": "0300",
"message": "Invalid Request"
}
}