POST /payment/api/v1/
Request
Payload
-
amount (integer, required): Amount of the operation in decimals. 140 will be 1.4€.
-
redirect_after (required): URLs to which the user will be redirected.
- cancel (string, required): URL to which the user will be redirected if they cancel the operation. It will contain the
request_id
and will be accessed viaGET
. - success (string, required): URL to which the user will be redirected if the sale is successful. It will contain the
request_id
and will be accessed viaGET
. - failure (string, required): URL to which the user will be redirected if the sale fails. It will contain the
request_id
and will be accessed viaGET
.
- cancel (string, required): URL to which the user will be redirected if they cancel the operation. It will contain the
-
type (enum[string]): DEFAULT=capture
Parameter | Description |
---|---|
auto | The operation is authenticated and authorized in real time in the browser. |
capture | The operation is authenticated in real time in the browser and is only authorized when the merchant performs a confirmation. |
-
currency (string): DEFAULT=EUR. Any currency defined according to ISO_4217 will be valid.
-
order (string): Ticket for the operation.
-
expiration (integer): DEFAULT=900. Number of seconds until the payment session expires.
-
user_id (string): DEFAULT=0. Unique identifier for the customer's profile. The user's cards will be stored associated with this value. This value must not be modifiable by the client. "0" is a reserved value that means not to store or retrieve cards.
-
custom_css (string): Custom CSS for the payment page.
Parameter | Description |
---|---|
#hpp-app | Customize the background of the purchase info screen. Example: "custom_css": " #hpp-app{background: black;} |
.shopamounttext | Customize the text "Total Amount". Example: "custom_css":".shop__amount__text{font-size:2em !important;color:red !important;}" |
.shop__amount | Customize amount. Example: "custom_css":".shop__amount{font-size:2em !important;color:red;}" |
.shop__text | Customize cart header. Example: "custom_css":".shop__text{font-size:2em !important;color:rgb(133, 133, 133);}" |
.articledescriptiondetail__name | Customize item names in cart. Example: "custom_css":".article__description__detail__name{font-size:2em !important;color:red;}" |
.articledescriptiondetail__amount | Customize item amounts in cart. Example: "custom_css":".article__description__detail__amount{font-size:2em !important;color:#FFFFFF;}" |
.detailsmovilequantity | Customize cart header. Example: "custom_css":".details__movile__quantity{font-size:2em !important;color:red;}" |
.detailsmoviletotal__text | Customize "Total Amount" text. Example: "custom_css":".details__movile__total__text{font-size:2em !important;color:red;}" |
.detailsmoviletotal__amount | Customize amount. Example: "custom_css":".details__movile__total__amount{font-size:2em !important;color:red;}" |
"custom_css":".shop__amount__text{font-size:2em !important;color:red !important;} .shop__amount{color:red !important;}"
-
logo (string): Logo URI. You can use data-uris for base64 images.
-
custom_data (object): Unstructured custom data. This data will travel in the response when confirming the operation ("Step 3"). Example:
{"foo":"bar"}
-
cart (array):
- items (object): Shopping cart. Will be displayed on the payment page.
- sku (string): Unique identifier of the item.
- tax (string): Tax amount, in decimals.
- name (string): Product name.
- quantity (string): Quantity.
- amount (integer): Total amount of the product (including taxes and shipping).
- image (string): Image of the product.
- shipping (string): Shipping amount.
- items (object): Shopping cart. Will be displayed on the payment page.
-
callbacks: Server to server call that will send event information specified in
when
.- url (string): URL to which the callback will be made.
- when (enum):
Event | Description |
---|---|
payment_wall_load | The payment wall has been requested to load. |
confirmation | Confirmation made indicating that the charge has been processed. |
payment_wall_loaded | When the payment wall has finished loading (it has rendered). |
payment_wall_setup | All payment method scripts have loaded, but the payment wall has not rendered. |
payment_wall_drawn | All payment methods have been displayed on screen. |
payment_wall_payment_ok | The charge has been successfully completed; funds have been captured. |
payment_wall_payment_ok_dcc | The charge has been successfully completed using DCC; funds have been captured. |
payment_wall_payment_ko | The charge could not be processed. |
payment_wall_ko | An error has occurred in processing the charge. |
payment_wall_capture_ko | An error occurred during the capture of the payment instrument. |
payment_wall_processing_payment | The validation of the payment instrument is being sent to the issuer. |
payment_wall_execute_payment | A capture of the payment instrument has been requested for Apple Pay or Google Pay. |
payment_wall_process_redirect | Arrival at the merchant from a payment method that required redirection. |
payment_wall_offers_dcc | A request for currency selection in a DCC charge is being made. |
payment_wall_set_extra_data | - |
payment_wall_set_extra_headers | - |
payment_wall_set_validation_function | - |
payment_wall_update_extra_data | - |
payment_wall_set_cart_data | The items from the shopping cart have been successfully extracted. |
payment_wall_token_created | - |
payment_processed | - |
mail_sent | - |
Response
Payload(object)
- url (string): Indirect URL to the payment method selection page.
- payment_methods (object): Available payment methods.
- payment_method_name1 (object):
- url: Direct URL to the payment method.
- supports_tokenization (boolean):
True
if the payment method supports tokenization. - supports_recurring (boolean):
True
if the payment method supports recurring payments. - available_card_capturers(enum): Will show the supported and previously contracted wallets (gpay and apay).
- supports_refund (boolean):
True
if the payment method supports refunds. - supports_direct_payment (boolean):
True
if the payment method supports directly opening the payment method's page andpayment_method_name1
will containdirect_url
. - direct_url: Direct URL to the payment method's page. This field will only travel in the response if
supports_direct_payment
istrue
.
- payment_method_name1 (object):
Examples
Basic example
- Request
{
"key": "{{key}}",
"resource": "{{resource}}",
"mode": "sha256",
"nonce": "123123",
"payload": {
"amount": 15000,
"redirect_after": {
"cancel": "http://httpbin.org/get?type=cancel",
"success": "http://httpbin.org/get?type=ok",
"failure": "http://httpbin.org/get?type=ko"
}
}
}
- Response
{
"type": "resource.status",
"code": "0",
"detail": "Successful payment request.",
"payload": {
"url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/fastpay",
"payment_methods": {
"payment_method_name1": {
"url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/payment_method_name1",
"supports_card_data": true,
"supports_security_data": true,
"supports_tokenization": true,
"supports_recurring": true,
"available_card_capturers": [
"gpay",
"apay"
],
"supports_refund": true,
"supports_direct_payment": false
},
"payment_method_name2": {
"url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/payment_method_name2",
"supports_card_data": false,
"supports_security_data": false,
"supports_tokenization": false,
"supports_refund": false,
"supports_recurring": false,
"available_card_capturers": [],
"supports_direct_payment": true,
"direct_url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/payment_method_name2/direct"
}
}
}
},
"request_id": "6268ee6d5dff38d7bc33dd37",
"uuid": "6268ee6d5dff38d7bc33dd37"
}
Custom example
- Request
{
"key": "{{key}}",
"resource": "{{resource}}",
"mode": "sha256",
"nonce": "123123",
"payload": {
"currency": "EUR",
"custom_css": "body {font-size:1em;}",
"logo": "https://sipay.es/wp-content/uploads/logo.png",
"custom_data": {},
"amount": 15000,
"redirect_after": {
"cancel": "http://httpbin.org/post?type=cancel",
"success": "http://httpbin.org/post?type=ok",
"failure": "http://httpbin.org/post?type=ko"
}
}
}
- Response
{
"type": "resource.status",
"code": "0",
"detail": "Successful payment request.",
"payload": {
"url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/fastpay",
"payment_methods": {
"payment_method_name1": {
"url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/payment_method_name1",
"supports_card_data": true,
"supports_security_data": true,
"supports_tokenization": true,
"supports_recurring": true,
"available_card_capturers": [
"gpay",
"apay"
],
"supports_refund": true,
"supports_direct_payment": false
},
"payment_method_name2": {
"url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/payment_method_name2",
"supports_card_data": false,
"supports_security_data": false,
"supports_tokenization": false,
"supports_refund": false,
"supports_recurring": false,
"available_card_capturers": [],
"supports_direct_payment": true,
"direct_url": "https://sandbox.sipay.es/payment/api/v1/6268ee6d5dff38d7bc33dd37/payment_method_name2/direct"
}
}
}
},
"request_id": "6268ee6d5dff38d7bc33dd37",
"uuid": "6268ee6d5dff38d7bc33dd37"
}