Create a payment token
Before you use either the Palladium payment widget or the hosted payment page, you should create a payment token.
Request
Send a POST
request to https://checkout.pall-psp.com/ctp/api/checkouts
.
The request must:
- use HTTP Basic authentication with Shop ID and Secret Key;
- have the headers
Content-Type: application/json
,Accept: application/json
andX-API-Version: 2
; - be UTF-8 encoded.
|
Request example
{
"checkout": {
"test": true,
"transaction_type": "payment",
"attempts": 3,
"settings": {
"return_url": "http://127.0.0.1:4567/return",
"success_url": "http://127.0.0.1:4567/success",
"decline_url": "http://127.0.0.1:4567/decline",
"fail_url": "http://127.0.0.1:4567/fail",
"cancel_url": "http://127.0.0.1:4567/cancel",
"notification_url": "http://your_shop.com/notification",
"button_next_text": "Back to the shop",
"language": "en",
"customer_fields" : {
"visible" : ["first_name", "last_name"],
"read_only" : ["email"]
},
"credit_card_fields": {
"holder": "Rick Astley",
"read_only": ["holder"]
}
},
"payment_method": {
"types": [
"credit_card",
"bank_transfer"
],
"bank_transfer": {
"account": "DE89370400440532013000"
},
"excluded_brands": [
"visa",
"google_pay"
]
},
"order": {
"currency": "GBP",
"amount": 4299,
"description": "Order description"
},
"customer": {
"address": "Baker street 221b",
"country": "GB",
"city": "London",
"email": "jake@example.com"
}
}
}
Request example with additional receipt text and without redirect to result page
{
"checkout": {
"test": true,
"transaction_type": "payment",
"attempts": 3,
"settings": {
"return_url": "http://127.0.0.1:4567/return",
"success_url": "http://127.0.0.1:4567/success",
"decline_url": "http://127.0.0.1:4567/decline",
"fail_url": "http://127.0.0.1:4567/fail",
"cancel_url": "http://127.0.0.1:4567/cancel",
"notification_url": "http://your_shop.com/notification",
"auto_return": 0,
"language": "en",
"customer_fields" : {
"visible" : ["first_name", "last_name"],
"read_only" : ["email"]
}
},
"order": {
"currency": "GBP",
"amount": 4299,
"description": "Order description",
"additional_data": {
"receipt_text": ["First line", "Second line"]
}
},
"customer": {
"address": "Baker street 221b",
"country": "GB",
"city": "London",
"email": "jake@example.com"
}
}
}
Request example with information about the sale of tickets and tour vouchers
{
"checkout": {
"test": true,
"transaction_type": "payment",
"attempts": 3,
"settings": {
"return_url": "http://127.0.0.1:4567/return",
"success_url": "http://127.0.0.1:4567/success",
"decline_url": "http://127.0.0.1:4567/decline",
"fail_url": "http://127.0.0.1:4567/fail",
"cancel_url": "http://127.0.0.1:4567/cancel",
"notification_url": "http://your_shop.com/notification",
"auto_return": 3,
"button_next_text": "Back to the shop",
"language": "en",
"customer_fields" : {
"visible" : ["first_name", "last_name"],
"read_only" : ["email"]
}
},
"order": {
"currency": "GBP",
"amount": 4299,
"description": "Order description"
},
"customer": {
"address": "Baker street 221b",
"country": "GB",
"city": "London",
"email": "jake@example.com"
},
"travel": {
"airline": {
"agency_code": "03",
"agency_name": "Corel travel",
"ticket_number": "390 5241 025377 1",
"booking_number": "DKZVUA",
"restricted_ticked_indicator": "0",
"legs": [
{
"airline_code": "B2",
"stop_over_code": "X",
"flight_number": "A3 971",
"departure_date_time": "2014-05-26T05:15:00",
"arrival_date_time": "2014-05-26T07:30:00",
"originating_country": "RU",
"originating_city": "Moscow",
"originating_airport_code": "DME",
"destination_country": "Greece",
"destination_city": "Athens",
"destination_airport_code": "ATH",
"coupon": "coupon code",
"class": "C"
}
],
"passengers":[
{
"first_name": "KONSTANTIN",
"last_name": "IVANOV"
},
{
"first_name": "JULIA",
"last_name": "IVANOVA"
}
]
}
}
}
}
Request example with auto_pay
: true
{
"checkout": {
"test": true,
"transaction_type": "payment",
"attempts": 3,
"iframe": true,
"settings": {
"return_url": "https://return-url",
"auto_pay": true,
"language": "en"
},
"payment_method": {
"types": [
"credit_card"
],
"credit_card": {
"token": "13dded21-ed69-4590-8bcb-db522a89735c"
}
},
"order": {
"currency": "USD",
"amount": 700,
"description": "auto payment"
},
"customer": {
"first_name": "John",
"last_name": "Doe"
}
}
}
Response
In the transaction section response parameters replicate request parameters except the additional one:
|
Response example
{
"checkout":
{
"token": "3241e439f8c87d941d92621a4bdc030d4c9a69c67f3b0cfe12de4a13cc34aa51",
"redirect_url": "https://checkout.pall-psp.com/v2/checkout?token=3241e439f8c87d941d92621a4bdc030d4c9a69c67f3b0cfe12de4a13cc34aa51"
}
}
Error response example
{
"errors": {
"checkout": {
"settings": {
"fail_url": [
"is in invalid format"
]
},
"payment_method": {
"types": [
"must be an array"
]
}
}
},
"message": "fail_url is in invalid format, types must be an array"
}