curl --request POST \
--url https://{subdomain}.truust.io/2.0/payins \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_id": 4950,
"type": "REDSYS_V2",
"save_card": 1
}
'import requests
url = "https://{subdomain}.truust.io/2.0/payins"
payload = {
"order_id": 4950,
"type": "REDSYS_V2",
"save_card": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_id: 4950, type: 'REDSYS_V2', save_card: 1})
};
fetch('https://{subdomain}.truust.io/2.0/payins', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.truust.io/2.0/payins",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'order_id' => 4950,
'type' => 'REDSYS_V2',
'save_card' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.truust.io/2.0/payins"
payload := strings.NewReader("{\n \"order_id\": 4950,\n \"type\": \"REDSYS_V2\",\n \"save_card\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.truust.io/2.0/payins")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_id\": 4950,\n \"type\": \"REDSYS_V2\",\n \"save_card\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/payins")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"order_id\": 4950,\n \"type\": \"REDSYS_V2\",\n \"save_card\": 1\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/payins/456",
"reference": "<string>",
"type": "<string>",
"subtype": "<string>",
"status": "CREATED",
"provider": {},
"tag": "<string>",
"direct_link": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"denied_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Create Payin
Creates a payin (payment intent) for an order. Requires order_id and either type or gateway_id.
For card payments, the response includes a direct_link to the payment page.
For bank wire payments, the response includes bank transfer details in provider.
curl --request POST \
--url https://{subdomain}.truust.io/2.0/payins \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_id": 4950,
"type": "REDSYS_V2",
"save_card": 1
}
'import requests
url = "https://{subdomain}.truust.io/2.0/payins"
payload = {
"order_id": 4950,
"type": "REDSYS_V2",
"save_card": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_id: 4950, type: 'REDSYS_V2', save_card: 1})
};
fetch('https://{subdomain}.truust.io/2.0/payins', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.truust.io/2.0/payins",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'order_id' => 4950,
'type' => 'REDSYS_V2',
'save_card' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.truust.io/2.0/payins"
payload := strings.NewReader("{\n \"order_id\": 4950,\n \"type\": \"REDSYS_V2\",\n \"save_card\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.truust.io/2.0/payins")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_id\": 4950,\n \"type\": \"REDSYS_V2\",\n \"save_card\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/payins")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"order_id\": 4950,\n \"type\": \"REDSYS_V2\",\n \"save_card\": 1\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/payins/456",
"reference": "<string>",
"type": "<string>",
"subtype": "<string>",
"status": "CREATED",
"provider": {},
"tag": "<string>",
"direct_link": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"denied_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Authorizations
Use your account's Secret Key as the Bearer token.
Body
ID of the order to pay.
4950
Payment method type. Valid values include BANKWIRE, WALLET, and any registered gateway type for the account
(e.g. REDSYS_V2, ADDON, ADDON_V2, ADDON_ICE, ADDON_HPP, ADDON_APPLE_PAY, AZUPAY, DCP, EPX,
REDSYS_APPLE_PAY, REDSYS_AUTH, STRIPE, DOCOMO, SIBS_MBWAY, SIBS_MULTIBANCO, SEQURA, UNNAX,
PAYPAL, BIZUM, INESPAY).
"REDSYS_V2"
Gateway ID to use. Alternative to type.
Saved card ID to charge (for recurring or one-click payments).
Wallet ID to debit. Required when type is WALLET.
Set to 1 to tokenize and save the card for future use.
0, 1 Response
Payin created
"/2.0/payins/456"
Provider's payment reference ID.
Payment method type (e.g. CARD, BANKWIRE, WALLET).
CREATED, AUTHORIZED, CONFIRMED, DENIED, REFUNDED, CANCELLED Raw provider response data.
Payment page URL. Only present when status is CREATED or AUTHORIZED.
Hypermedia links to related resources.
Show child attributes
Show child attributes
