Klarna Payments API V1
DELETE
Cancel an authorization
{{baseUrl}}/payments/v1/authorizations/:authorizationToken
QUERY PARAMS
authorizationToken
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/payments/v1/authorizations/:authorizationToken");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/payments/v1/authorizations/:authorizationToken")
require "http/client"
url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/payments/v1/authorizations/:authorizationToken"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/payments/v1/authorizations/:authorizationToken");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/payments/v1/authorizations/:authorizationToken"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/payments/v1/authorizations/:authorizationToken HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/payments/v1/authorizations/:authorizationToken")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/payments/v1/authorizations/:authorizationToken"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/payments/v1/authorizations/:authorizationToken")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/payments/v1/authorizations/:authorizationToken")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/payments/v1/authorizations/:authorizationToken';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/payments/v1/authorizations/:authorizationToken")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/payments/v1/authorizations/:authorizationToken',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/payments/v1/authorizations/:authorizationToken';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/payments/v1/authorizations/:authorizationToken"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/payments/v1/authorizations/:authorizationToken" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/payments/v1/authorizations/:authorizationToken",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken');
echo $response->getBody();
setUrl('{{baseUrl}}/payments/v1/authorizations/:authorizationToken');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/payments/v1/authorizations/:authorizationToken');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/payments/v1/authorizations/:authorizationToken' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/payments/v1/authorizations/:authorizationToken' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/payments/v1/authorizations/:authorizationToken")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/payments/v1/authorizations/:authorizationToken"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/payments/v1/authorizations/:authorizationToken")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/payments/v1/authorizations/:authorizationToken') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/payments/v1/authorizations/:authorizationToken
http DELETE {{baseUrl}}/payments/v1/authorizations/:authorizationToken
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/payments/v1/authorizations/:authorizationToken
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/payments/v1/authorizations/:authorizationToken")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a session
{{baseUrl}}/payments/v1/sessions
BODY json
{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/payments/v1/sessions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/payments/v1/sessions" {:content-type :json
:form-params {:acquiring_channel ""
:attachment {:body ""
:content_type ""}
:authorization_token ""
:billing_address {:title ""
:attention ""
:city ""
:country ""
:email ""
:family_name ""
:given_name ""
:organization_name ""
:phone ""
:postal_code ""
:region ""
:street_address ""
:street_address2 ""}
:client_token ""
:custom_payment_method_ids []
:customer {:title ""
:date_of_birth ""
:gender ""
:last_four_ssn ""
:national_identification_number ""
:organization_entity_type ""
:organization_registration_id ""
:type ""
:vat_id ""}
:design ""
:expires_at ""
:locale ""
:merchant_data ""
:merchant_reference1 ""
:merchant_reference2 ""
:merchant_urls {:confirmation ""
:notification ""
:push ""
:authorization ""}
:options {:color_border ""
:color_border_selected ""
:color_details ""
:color_text ""
:radius_border ""}
:order_amount 0
:order_lines [{:image_url ""
:merchant_data ""
:name ""
:product_identifiers {:brand ""
:category_path ""
:global_trade_item_number ""
:manufacturer_part_number ""
:color ""
:size ""}
:product_url ""
:quantity 0
:quantity_unit ""
:reference ""
:tax_rate 0
:total_amount 0
:total_discount_amount 0
:total_tax_amount 0
:type ""
:unit_price 0
:subscription {:name ""
:interval ""
:interval_count 0}}]
:order_tax_amount 0
:payment_method_categories [{:asset_urls {:descriptive ""
:standard ""}
:identifier ""
:name ""}]
:purchase_country ""
:purchase_currency ""
:shipping_address {}
:status ""
:intent ""}})
require "http/client"
url = "{{baseUrl}}/payments/v1/sessions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/payments/v1/sessions"),
Content = new StringContent("{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/payments/v1/sessions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/payments/v1/sessions"
payload := strings.NewReader("{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/payments/v1/sessions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2124
{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/payments/v1/sessions")
.setHeader("content-type", "application/json")
.setBody("{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/payments/v1/sessions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/payments/v1/sessions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/payments/v1/sessions")
.header("content-type", "application/json")
.body("{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}")
.asString();
const data = JSON.stringify({
acquiring_channel: '',
attachment: {
body: '',
content_type: ''
},
authorization_token: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
client_token: '',
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
design: '',
expires_at: '',
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {
confirmation: '',
notification: '',
push: '',
authorization: ''
},
options: {
color_border: '',
color_border_selected: '',
color_details: '',
color_text: '',
radius_border: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {
name: '',
interval: '',
interval_count: 0
}
}
],
order_tax_amount: 0,
payment_method_categories: [
{
asset_urls: {
descriptive: '',
standard: ''
},
identifier: '',
name: ''
}
],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: '',
intent: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/payments/v1/sessions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/sessions',
headers: {'content-type': 'application/json'},
data: {
acquiring_channel: '',
attachment: {body: '', content_type: ''},
authorization_token: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
client_token: '',
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
design: '',
expires_at: '',
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
options: {
color_border: '',
color_border_selected: '',
color_details: '',
color_text: '',
radius_border: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: '',
intent: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/payments/v1/sessions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"acquiring_channel":"","attachment":{"body":"","content_type":""},"authorization_token":"","billing_address":{"title":"","attention":"","city":"","country":"","email":"","family_name":"","given_name":"","organization_name":"","phone":"","postal_code":"","region":"","street_address":"","street_address2":""},"client_token":"","custom_payment_method_ids":[],"customer":{"title":"","date_of_birth":"","gender":"","last_four_ssn":"","national_identification_number":"","organization_entity_type":"","organization_registration_id":"","type":"","vat_id":""},"design":"","expires_at":"","locale":"","merchant_data":"","merchant_reference1":"","merchant_reference2":"","merchant_urls":{"confirmation":"","notification":"","push":"","authorization":""},"options":{"color_border":"","color_border_selected":"","color_details":"","color_text":"","radius_border":""},"order_amount":0,"order_lines":[{"image_url":"","merchant_data":"","name":"","product_identifiers":{"brand":"","category_path":"","global_trade_item_number":"","manufacturer_part_number":"","color":"","size":""},"product_url":"","quantity":0,"quantity_unit":"","reference":"","tax_rate":0,"total_amount":0,"total_discount_amount":0,"total_tax_amount":0,"type":"","unit_price":0,"subscription":{"name":"","interval":"","interval_count":0}}],"order_tax_amount":0,"payment_method_categories":[{"asset_urls":{"descriptive":"","standard":""},"identifier":"","name":""}],"purchase_country":"","purchase_currency":"","shipping_address":{},"status":"","intent":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/payments/v1/sessions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "acquiring_channel": "",\n "attachment": {\n "body": "",\n "content_type": ""\n },\n "authorization_token": "",\n "billing_address": {\n "title": "",\n "attention": "",\n "city": "",\n "country": "",\n "email": "",\n "family_name": "",\n "given_name": "",\n "organization_name": "",\n "phone": "",\n "postal_code": "",\n "region": "",\n "street_address": "",\n "street_address2": ""\n },\n "client_token": "",\n "custom_payment_method_ids": [],\n "customer": {\n "title": "",\n "date_of_birth": "",\n "gender": "",\n "last_four_ssn": "",\n "national_identification_number": "",\n "organization_entity_type": "",\n "organization_registration_id": "",\n "type": "",\n "vat_id": ""\n },\n "design": "",\n "expires_at": "",\n "locale": "",\n "merchant_data": "",\n "merchant_reference1": "",\n "merchant_reference2": "",\n "merchant_urls": {\n "confirmation": "",\n "notification": "",\n "push": "",\n "authorization": ""\n },\n "options": {\n "color_border": "",\n "color_border_selected": "",\n "color_details": "",\n "color_text": "",\n "radius_border": ""\n },\n "order_amount": 0,\n "order_lines": [\n {\n "image_url": "",\n "merchant_data": "",\n "name": "",\n "product_identifiers": {\n "brand": "",\n "category_path": "",\n "global_trade_item_number": "",\n "manufacturer_part_number": "",\n "color": "",\n "size": ""\n },\n "product_url": "",\n "quantity": 0,\n "quantity_unit": "",\n "reference": "",\n "tax_rate": 0,\n "total_amount": 0,\n "total_discount_amount": 0,\n "total_tax_amount": 0,\n "type": "",\n "unit_price": 0,\n "subscription": {\n "name": "",\n "interval": "",\n "interval_count": 0\n }\n }\n ],\n "order_tax_amount": 0,\n "payment_method_categories": [\n {\n "asset_urls": {\n "descriptive": "",\n "standard": ""\n },\n "identifier": "",\n "name": ""\n }\n ],\n "purchase_country": "",\n "purchase_currency": "",\n "shipping_address": {},\n "status": "",\n "intent": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/payments/v1/sessions")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/payments/v1/sessions',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
acquiring_channel: '',
attachment: {body: '', content_type: ''},
authorization_token: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
client_token: '',
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
design: '',
expires_at: '',
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
options: {
color_border: '',
color_border_selected: '',
color_details: '',
color_text: '',
radius_border: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: '',
intent: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/sessions',
headers: {'content-type': 'application/json'},
body: {
acquiring_channel: '',
attachment: {body: '', content_type: ''},
authorization_token: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
client_token: '',
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
design: '',
expires_at: '',
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
options: {
color_border: '',
color_border_selected: '',
color_details: '',
color_text: '',
radius_border: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: '',
intent: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/payments/v1/sessions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
acquiring_channel: '',
attachment: {
body: '',
content_type: ''
},
authorization_token: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
client_token: '',
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
design: '',
expires_at: '',
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {
confirmation: '',
notification: '',
push: '',
authorization: ''
},
options: {
color_border: '',
color_border_selected: '',
color_details: '',
color_text: '',
radius_border: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {
name: '',
interval: '',
interval_count: 0
}
}
],
order_tax_amount: 0,
payment_method_categories: [
{
asset_urls: {
descriptive: '',
standard: ''
},
identifier: '',
name: ''
}
],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: '',
intent: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/sessions',
headers: {'content-type': 'application/json'},
data: {
acquiring_channel: '',
attachment: {body: '', content_type: ''},
authorization_token: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
client_token: '',
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
design: '',
expires_at: '',
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
options: {
color_border: '',
color_border_selected: '',
color_details: '',
color_text: '',
radius_border: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: '',
intent: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/payments/v1/sessions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"acquiring_channel":"","attachment":{"body":"","content_type":""},"authorization_token":"","billing_address":{"title":"","attention":"","city":"","country":"","email":"","family_name":"","given_name":"","organization_name":"","phone":"","postal_code":"","region":"","street_address":"","street_address2":""},"client_token":"","custom_payment_method_ids":[],"customer":{"title":"","date_of_birth":"","gender":"","last_four_ssn":"","national_identification_number":"","organization_entity_type":"","organization_registration_id":"","type":"","vat_id":""},"design":"","expires_at":"","locale":"","merchant_data":"","merchant_reference1":"","merchant_reference2":"","merchant_urls":{"confirmation":"","notification":"","push":"","authorization":""},"options":{"color_border":"","color_border_selected":"","color_details":"","color_text":"","radius_border":""},"order_amount":0,"order_lines":[{"image_url":"","merchant_data":"","name":"","product_identifiers":{"brand":"","category_path":"","global_trade_item_number":"","manufacturer_part_number":"","color":"","size":""},"product_url":"","quantity":0,"quantity_unit":"","reference":"","tax_rate":0,"total_amount":0,"total_discount_amount":0,"total_tax_amount":0,"type":"","unit_price":0,"subscription":{"name":"","interval":"","interval_count":0}}],"order_tax_amount":0,"payment_method_categories":[{"asset_urls":{"descriptive":"","standard":""},"identifier":"","name":""}],"purchase_country":"","purchase_currency":"","shipping_address":{},"status":"","intent":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"acquiring_channel": @"",
@"attachment": @{ @"body": @"", @"content_type": @"" },
@"authorization_token": @"",
@"billing_address": @{ @"title": @"", @"attention": @"", @"city": @"", @"country": @"", @"email": @"", @"family_name": @"", @"given_name": @"", @"organization_name": @"", @"phone": @"", @"postal_code": @"", @"region": @"", @"street_address": @"", @"street_address2": @"" },
@"client_token": @"",
@"custom_payment_method_ids": @[ ],
@"customer": @{ @"title": @"", @"date_of_birth": @"", @"gender": @"", @"last_four_ssn": @"", @"national_identification_number": @"", @"organization_entity_type": @"", @"organization_registration_id": @"", @"type": @"", @"vat_id": @"" },
@"design": @"",
@"expires_at": @"",
@"locale": @"",
@"merchant_data": @"",
@"merchant_reference1": @"",
@"merchant_reference2": @"",
@"merchant_urls": @{ @"confirmation": @"", @"notification": @"", @"push": @"", @"authorization": @"" },
@"options": @{ @"color_border": @"", @"color_border_selected": @"", @"color_details": @"", @"color_text": @"", @"radius_border": @"" },
@"order_amount": @0,
@"order_lines": @[ @{ @"image_url": @"", @"merchant_data": @"", @"name": @"", @"product_identifiers": @{ @"brand": @"", @"category_path": @"", @"global_trade_item_number": @"", @"manufacturer_part_number": @"", @"color": @"", @"size": @"" }, @"product_url": @"", @"quantity": @0, @"quantity_unit": @"", @"reference": @"", @"tax_rate": @0, @"total_amount": @0, @"total_discount_amount": @0, @"total_tax_amount": @0, @"type": @"", @"unit_price": @0, @"subscription": @{ @"name": @"", @"interval": @"", @"interval_count": @0 } } ],
@"order_tax_amount": @0,
@"payment_method_categories": @[ @{ @"asset_urls": @{ @"descriptive": @"", @"standard": @"" }, @"identifier": @"", @"name": @"" } ],
@"purchase_country": @"",
@"purchase_currency": @"",
@"shipping_address": @{ },
@"status": @"",
@"intent": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/payments/v1/sessions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/payments/v1/sessions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/payments/v1/sessions",
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([
'acquiring_channel' => '',
'attachment' => [
'body' => '',
'content_type' => ''
],
'authorization_token' => '',
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'client_token' => '',
'custom_payment_method_ids' => [
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'design' => '',
'expires_at' => '',
'locale' => '',
'merchant_data' => '',
'merchant_reference1' => '',
'merchant_reference2' => '',
'merchant_urls' => [
'confirmation' => '',
'notification' => '',
'push' => '',
'authorization' => ''
],
'options' => [
'color_border' => '',
'color_border_selected' => '',
'color_details' => '',
'color_text' => '',
'radius_border' => ''
],
'order_amount' => 0,
'order_lines' => [
[
'image_url' => '',
'merchant_data' => '',
'name' => '',
'product_identifiers' => [
'brand' => '',
'category_path' => '',
'global_trade_item_number' => '',
'manufacturer_part_number' => '',
'color' => '',
'size' => ''
],
'product_url' => '',
'quantity' => 0,
'quantity_unit' => '',
'reference' => '',
'tax_rate' => 0,
'total_amount' => 0,
'total_discount_amount' => 0,
'total_tax_amount' => 0,
'type' => '',
'unit_price' => 0,
'subscription' => [
'name' => '',
'interval' => '',
'interval_count' => 0
]
]
],
'order_tax_amount' => 0,
'payment_method_categories' => [
[
'asset_urls' => [
'descriptive' => '',
'standard' => ''
],
'identifier' => '',
'name' => ''
]
],
'purchase_country' => '',
'purchase_currency' => '',
'shipping_address' => [
],
'status' => '',
'intent' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/payments/v1/sessions', [
'body' => '{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/payments/v1/sessions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'acquiring_channel' => '',
'attachment' => [
'body' => '',
'content_type' => ''
],
'authorization_token' => '',
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'client_token' => '',
'custom_payment_method_ids' => [
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'design' => '',
'expires_at' => '',
'locale' => '',
'merchant_data' => '',
'merchant_reference1' => '',
'merchant_reference2' => '',
'merchant_urls' => [
'confirmation' => '',
'notification' => '',
'push' => '',
'authorization' => ''
],
'options' => [
'color_border' => '',
'color_border_selected' => '',
'color_details' => '',
'color_text' => '',
'radius_border' => ''
],
'order_amount' => 0,
'order_lines' => [
[
'image_url' => '',
'merchant_data' => '',
'name' => '',
'product_identifiers' => [
'brand' => '',
'category_path' => '',
'global_trade_item_number' => '',
'manufacturer_part_number' => '',
'color' => '',
'size' => ''
],
'product_url' => '',
'quantity' => 0,
'quantity_unit' => '',
'reference' => '',
'tax_rate' => 0,
'total_amount' => 0,
'total_discount_amount' => 0,
'total_tax_amount' => 0,
'type' => '',
'unit_price' => 0,
'subscription' => [
'name' => '',
'interval' => '',
'interval_count' => 0
]
]
],
'order_tax_amount' => 0,
'payment_method_categories' => [
[
'asset_urls' => [
'descriptive' => '',
'standard' => ''
],
'identifier' => '',
'name' => ''
]
],
'purchase_country' => '',
'purchase_currency' => '',
'shipping_address' => [
],
'status' => '',
'intent' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'acquiring_channel' => '',
'attachment' => [
'body' => '',
'content_type' => ''
],
'authorization_token' => '',
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'client_token' => '',
'custom_payment_method_ids' => [
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'design' => '',
'expires_at' => '',
'locale' => '',
'merchant_data' => '',
'merchant_reference1' => '',
'merchant_reference2' => '',
'merchant_urls' => [
'confirmation' => '',
'notification' => '',
'push' => '',
'authorization' => ''
],
'options' => [
'color_border' => '',
'color_border_selected' => '',
'color_details' => '',
'color_text' => '',
'radius_border' => ''
],
'order_amount' => 0,
'order_lines' => [
[
'image_url' => '',
'merchant_data' => '',
'name' => '',
'product_identifiers' => [
'brand' => '',
'category_path' => '',
'global_trade_item_number' => '',
'manufacturer_part_number' => '',
'color' => '',
'size' => ''
],
'product_url' => '',
'quantity' => 0,
'quantity_unit' => '',
'reference' => '',
'tax_rate' => 0,
'total_amount' => 0,
'total_discount_amount' => 0,
'total_tax_amount' => 0,
'type' => '',
'unit_price' => 0,
'subscription' => [
'name' => '',
'interval' => '',
'interval_count' => 0
]
]
],
'order_tax_amount' => 0,
'payment_method_categories' => [
[
'asset_urls' => [
'descriptive' => '',
'standard' => ''
],
'identifier' => '',
'name' => ''
]
],
'purchase_country' => '',
'purchase_currency' => '',
'shipping_address' => [
],
'status' => '',
'intent' => ''
]));
$request->setRequestUrl('{{baseUrl}}/payments/v1/sessions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/payments/v1/sessions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/payments/v1/sessions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/payments/v1/sessions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/payments/v1/sessions"
payload = {
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/payments/v1/sessions"
payload <- "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/payments/v1/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/payments/v1/sessions') do |req|
req.body = "{\n \"acquiring_channel\": \"\",\n \"attachment\": {\n \"body\": \"\",\n \"content_type\": \"\"\n },\n \"authorization_token\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"client_token\": \"\",\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"design\": \"\",\n \"expires_at\": \"\",\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"options\": {\n \"color_border\": \"\",\n \"color_border_selected\": \"\",\n \"color_details\": \"\",\n \"color_text\": \"\",\n \"radius_border\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\",\n \"intent\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/payments/v1/sessions";
let payload = json!({
"acquiring_channel": "",
"attachment": json!({
"body": "",
"content_type": ""
}),
"authorization_token": "",
"billing_address": json!({
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
}),
"client_token": "",
"custom_payment_method_ids": (),
"customer": json!({
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
}),
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": json!({
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
}),
"options": json!({
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
}),
"order_amount": 0,
"order_lines": (
json!({
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": json!({
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
}),
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": json!({
"name": "",
"interval": "",
"interval_count": 0
})
})
),
"order_tax_amount": 0,
"payment_method_categories": (
json!({
"asset_urls": json!({
"descriptive": "",
"standard": ""
}),
"identifier": "",
"name": ""
})
),
"purchase_country": "",
"purchase_currency": "",
"shipping_address": json!({}),
"status": "",
"intent": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/payments/v1/sessions \
--header 'content-type: application/json' \
--data '{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}'
echo '{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}' | \
http POST {{baseUrl}}/payments/v1/sessions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "acquiring_channel": "",\n "attachment": {\n "body": "",\n "content_type": ""\n },\n "authorization_token": "",\n "billing_address": {\n "title": "",\n "attention": "",\n "city": "",\n "country": "",\n "email": "",\n "family_name": "",\n "given_name": "",\n "organization_name": "",\n "phone": "",\n "postal_code": "",\n "region": "",\n "street_address": "",\n "street_address2": ""\n },\n "client_token": "",\n "custom_payment_method_ids": [],\n "customer": {\n "title": "",\n "date_of_birth": "",\n "gender": "",\n "last_four_ssn": "",\n "national_identification_number": "",\n "organization_entity_type": "",\n "organization_registration_id": "",\n "type": "",\n "vat_id": ""\n },\n "design": "",\n "expires_at": "",\n "locale": "",\n "merchant_data": "",\n "merchant_reference1": "",\n "merchant_reference2": "",\n "merchant_urls": {\n "confirmation": "",\n "notification": "",\n "push": "",\n "authorization": ""\n },\n "options": {\n "color_border": "",\n "color_border_selected": "",\n "color_details": "",\n "color_text": "",\n "radius_border": ""\n },\n "order_amount": 0,\n "order_lines": [\n {\n "image_url": "",\n "merchant_data": "",\n "name": "",\n "product_identifiers": {\n "brand": "",\n "category_path": "",\n "global_trade_item_number": "",\n "manufacturer_part_number": "",\n "color": "",\n "size": ""\n },\n "product_url": "",\n "quantity": 0,\n "quantity_unit": "",\n "reference": "",\n "tax_rate": 0,\n "total_amount": 0,\n "total_discount_amount": 0,\n "total_tax_amount": 0,\n "type": "",\n "unit_price": 0,\n "subscription": {\n "name": "",\n "interval": "",\n "interval_count": 0\n }\n }\n ],\n "order_tax_amount": 0,\n "payment_method_categories": [\n {\n "asset_urls": {\n "descriptive": "",\n "standard": ""\n },\n "identifier": "",\n "name": ""\n }\n ],\n "purchase_country": "",\n "purchase_currency": "",\n "shipping_address": {},\n "status": "",\n "intent": ""\n}' \
--output-document \
- {{baseUrl}}/payments/v1/sessions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"acquiring_channel": "",
"attachment": [
"body": "",
"content_type": ""
],
"authorization_token": "",
"billing_address": [
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
],
"client_token": "",
"custom_payment_method_ids": [],
"customer": [
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
],
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": [
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
],
"options": [
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
],
"order_amount": 0,
"order_lines": [
[
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": [
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
],
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": [
"name": "",
"interval": "",
"interval_count": 0
]
]
],
"order_tax_amount": 0,
"payment_method_categories": [
[
"asset_urls": [
"descriptive": "",
"standard": ""
],
"identifier": "",
"name": ""
]
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": [],
"status": "",
"intent": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/payments/v1/sessions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"session_id": "0b1d9815-165e-42e2-8867-35bc03789e00"
}
POST
Create an order
{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order
QUERY PARAMS
authorizationToken
BODY json
{
"authorization_token": "",
"auto_capture": false,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order" {:content-type :json
:form-params {:authorization_token ""
:auto_capture false
:billing_address {:title ""
:attention ""
:city ""
:country ""
:email ""
:family_name ""
:given_name ""
:organization_name ""
:phone ""
:postal_code ""
:region ""
:street_address ""
:street_address2 ""}
:custom_payment_method_ids []
:customer {:title ""
:date_of_birth ""
:gender ""
:last_four_ssn ""
:national_identification_number ""
:organization_entity_type ""
:organization_registration_id ""
:type ""
:vat_id ""}
:locale ""
:merchant_data ""
:merchant_reference1 ""
:merchant_reference2 ""
:merchant_urls {:confirmation ""
:notification ""
:push ""
:authorization ""}
:order_amount 0
:order_lines [{:image_url ""
:merchant_data ""
:name ""
:product_identifiers {:brand ""
:category_path ""
:global_trade_item_number ""
:manufacturer_part_number ""
:color ""
:size ""}
:product_url ""
:quantity 0
:quantity_unit ""
:reference ""
:tax_rate 0
:total_amount 0
:total_discount_amount 0
:total_tax_amount 0
:type ""
:unit_price 0
:subscription {:name ""
:interval ""
:interval_count 0}}]
:order_tax_amount 0
:payment_method_categories [{:asset_urls {:descriptive ""
:standard ""}
:identifier ""
:name ""}]
:purchase_country ""
:purchase_currency ""
:shipping_address {}
:status ""}})
require "http/client"
url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order"),
Content = new StringContent("{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order"
payload := strings.NewReader("{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/payments/v1/authorizations/:authorizationToken/order HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1838
{
"authorization_token": "",
"auto_capture": false,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order")
.setHeader("content-type", "application/json")
.setBody("{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order")
.header("content-type", "application/json")
.body("{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}")
.asString();
const data = JSON.stringify({
authorization_token: '',
auto_capture: false,
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {
confirmation: '',
notification: '',
push: '',
authorization: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {
name: '',
interval: '',
interval_count: 0
}
}
],
order_tax_amount: 0,
payment_method_categories: [
{
asset_urls: {
descriptive: '',
standard: ''
},
identifier: '',
name: ''
}
],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order',
headers: {'content-type': 'application/json'},
data: {
authorization_token: '',
auto_capture: false,
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"authorization_token":"","auto_capture":false,"billing_address":{"title":"","attention":"","city":"","country":"","email":"","family_name":"","given_name":"","organization_name":"","phone":"","postal_code":"","region":"","street_address":"","street_address2":""},"custom_payment_method_ids":[],"customer":{"title":"","date_of_birth":"","gender":"","last_four_ssn":"","national_identification_number":"","organization_entity_type":"","organization_registration_id":"","type":"","vat_id":""},"locale":"","merchant_data":"","merchant_reference1":"","merchant_reference2":"","merchant_urls":{"confirmation":"","notification":"","push":"","authorization":""},"order_amount":0,"order_lines":[{"image_url":"","merchant_data":"","name":"","product_identifiers":{"brand":"","category_path":"","global_trade_item_number":"","manufacturer_part_number":"","color":"","size":""},"product_url":"","quantity":0,"quantity_unit":"","reference":"","tax_rate":0,"total_amount":0,"total_discount_amount":0,"total_tax_amount":0,"type":"","unit_price":0,"subscription":{"name":"","interval":"","interval_count":0}}],"order_tax_amount":0,"payment_method_categories":[{"asset_urls":{"descriptive":"","standard":""},"identifier":"","name":""}],"purchase_country":"","purchase_currency":"","shipping_address":{},"status":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "authorization_token": "",\n "auto_capture": false,\n "billing_address": {\n "title": "",\n "attention": "",\n "city": "",\n "country": "",\n "email": "",\n "family_name": "",\n "given_name": "",\n "organization_name": "",\n "phone": "",\n "postal_code": "",\n "region": "",\n "street_address": "",\n "street_address2": ""\n },\n "custom_payment_method_ids": [],\n "customer": {\n "title": "",\n "date_of_birth": "",\n "gender": "",\n "last_four_ssn": "",\n "national_identification_number": "",\n "organization_entity_type": "",\n "organization_registration_id": "",\n "type": "",\n "vat_id": ""\n },\n "locale": "",\n "merchant_data": "",\n "merchant_reference1": "",\n "merchant_reference2": "",\n "merchant_urls": {\n "confirmation": "",\n "notification": "",\n "push": "",\n "authorization": ""\n },\n "order_amount": 0,\n "order_lines": [\n {\n "image_url": "",\n "merchant_data": "",\n "name": "",\n "product_identifiers": {\n "brand": "",\n "category_path": "",\n "global_trade_item_number": "",\n "manufacturer_part_number": "",\n "color": "",\n "size": ""\n },\n "product_url": "",\n "quantity": 0,\n "quantity_unit": "",\n "reference": "",\n "tax_rate": 0,\n "total_amount": 0,\n "total_discount_amount": 0,\n "total_tax_amount": 0,\n "type": "",\n "unit_price": 0,\n "subscription": {\n "name": "",\n "interval": "",\n "interval_count": 0\n }\n }\n ],\n "order_tax_amount": 0,\n "payment_method_categories": [\n {\n "asset_urls": {\n "descriptive": "",\n "standard": ""\n },\n "identifier": "",\n "name": ""\n }\n ],\n "purchase_country": "",\n "purchase_currency": "",\n "shipping_address": {},\n "status": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/payments/v1/authorizations/:authorizationToken/order',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
authorization_token: '',
auto_capture: false,
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order',
headers: {'content-type': 'application/json'},
body: {
authorization_token: '',
auto_capture: false,
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
authorization_token: '',
auto_capture: false,
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {
confirmation: '',
notification: '',
push: '',
authorization: ''
},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {
name: '',
interval: '',
interval_count: 0
}
}
],
order_tax_amount: 0,
payment_method_categories: [
{
asset_urls: {
descriptive: '',
standard: ''
},
identifier: '',
name: ''
}
],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order',
headers: {'content-type': 'application/json'},
data: {
authorization_token: '',
auto_capture: false,
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
custom_payment_method_ids: [],
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
locale: '',
merchant_data: '',
merchant_reference1: '',
merchant_reference2: '',
merchant_urls: {confirmation: '', notification: '', push: '', authorization: ''},
order_amount: 0,
order_lines: [
{
image_url: '',
merchant_data: '',
name: '',
product_identifiers: {
brand: '',
category_path: '',
global_trade_item_number: '',
manufacturer_part_number: '',
color: '',
size: ''
},
product_url: '',
quantity: 0,
quantity_unit: '',
reference: '',
tax_rate: 0,
total_amount: 0,
total_discount_amount: 0,
total_tax_amount: 0,
type: '',
unit_price: 0,
subscription: {name: '', interval: '', interval_count: 0}
}
],
order_tax_amount: 0,
payment_method_categories: [{asset_urls: {descriptive: '', standard: ''}, identifier: '', name: ''}],
purchase_country: '',
purchase_currency: '',
shipping_address: {},
status: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"authorization_token":"","auto_capture":false,"billing_address":{"title":"","attention":"","city":"","country":"","email":"","family_name":"","given_name":"","organization_name":"","phone":"","postal_code":"","region":"","street_address":"","street_address2":""},"custom_payment_method_ids":[],"customer":{"title":"","date_of_birth":"","gender":"","last_four_ssn":"","national_identification_number":"","organization_entity_type":"","organization_registration_id":"","type":"","vat_id":""},"locale":"","merchant_data":"","merchant_reference1":"","merchant_reference2":"","merchant_urls":{"confirmation":"","notification":"","push":"","authorization":""},"order_amount":0,"order_lines":[{"image_url":"","merchant_data":"","name":"","product_identifiers":{"brand":"","category_path":"","global_trade_item_number":"","manufacturer_part_number":"","color":"","size":""},"product_url":"","quantity":0,"quantity_unit":"","reference":"","tax_rate":0,"total_amount":0,"total_discount_amount":0,"total_tax_amount":0,"type":"","unit_price":0,"subscription":{"name":"","interval":"","interval_count":0}}],"order_tax_amount":0,"payment_method_categories":[{"asset_urls":{"descriptive":"","standard":""},"identifier":"","name":""}],"purchase_country":"","purchase_currency":"","shipping_address":{},"status":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"authorization_token": @"",
@"auto_capture": @NO,
@"billing_address": @{ @"title": @"", @"attention": @"", @"city": @"", @"country": @"", @"email": @"", @"family_name": @"", @"given_name": @"", @"organization_name": @"", @"phone": @"", @"postal_code": @"", @"region": @"", @"street_address": @"", @"street_address2": @"" },
@"custom_payment_method_ids": @[ ],
@"customer": @{ @"title": @"", @"date_of_birth": @"", @"gender": @"", @"last_four_ssn": @"", @"national_identification_number": @"", @"organization_entity_type": @"", @"organization_registration_id": @"", @"type": @"", @"vat_id": @"" },
@"locale": @"",
@"merchant_data": @"",
@"merchant_reference1": @"",
@"merchant_reference2": @"",
@"merchant_urls": @{ @"confirmation": @"", @"notification": @"", @"push": @"", @"authorization": @"" },
@"order_amount": @0,
@"order_lines": @[ @{ @"image_url": @"", @"merchant_data": @"", @"name": @"", @"product_identifiers": @{ @"brand": @"", @"category_path": @"", @"global_trade_item_number": @"", @"manufacturer_part_number": @"", @"color": @"", @"size": @"" }, @"product_url": @"", @"quantity": @0, @"quantity_unit": @"", @"reference": @"", @"tax_rate": @0, @"total_amount": @0, @"total_discount_amount": @0, @"total_tax_amount": @0, @"type": @"", @"unit_price": @0, @"subscription": @{ @"name": @"", @"interval": @"", @"interval_count": @0 } } ],
@"order_tax_amount": @0,
@"payment_method_categories": @[ @{ @"asset_urls": @{ @"descriptive": @"", @"standard": @"" }, @"identifier": @"", @"name": @"" } ],
@"purchase_country": @"",
@"purchase_currency": @"",
@"shipping_address": @{ },
@"status": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order",
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([
'authorization_token' => '',
'auto_capture' => null,
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'custom_payment_method_ids' => [
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'locale' => '',
'merchant_data' => '',
'merchant_reference1' => '',
'merchant_reference2' => '',
'merchant_urls' => [
'confirmation' => '',
'notification' => '',
'push' => '',
'authorization' => ''
],
'order_amount' => 0,
'order_lines' => [
[
'image_url' => '',
'merchant_data' => '',
'name' => '',
'product_identifiers' => [
'brand' => '',
'category_path' => '',
'global_trade_item_number' => '',
'manufacturer_part_number' => '',
'color' => '',
'size' => ''
],
'product_url' => '',
'quantity' => 0,
'quantity_unit' => '',
'reference' => '',
'tax_rate' => 0,
'total_amount' => 0,
'total_discount_amount' => 0,
'total_tax_amount' => 0,
'type' => '',
'unit_price' => 0,
'subscription' => [
'name' => '',
'interval' => '',
'interval_count' => 0
]
]
],
'order_tax_amount' => 0,
'payment_method_categories' => [
[
'asset_urls' => [
'descriptive' => '',
'standard' => ''
],
'identifier' => '',
'name' => ''
]
],
'purchase_country' => '',
'purchase_currency' => '',
'shipping_address' => [
],
'status' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order', [
'body' => '{
"authorization_token": "",
"auto_capture": false,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'authorization_token' => '',
'auto_capture' => null,
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'custom_payment_method_ids' => [
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'locale' => '',
'merchant_data' => '',
'merchant_reference1' => '',
'merchant_reference2' => '',
'merchant_urls' => [
'confirmation' => '',
'notification' => '',
'push' => '',
'authorization' => ''
],
'order_amount' => 0,
'order_lines' => [
[
'image_url' => '',
'merchant_data' => '',
'name' => '',
'product_identifiers' => [
'brand' => '',
'category_path' => '',
'global_trade_item_number' => '',
'manufacturer_part_number' => '',
'color' => '',
'size' => ''
],
'product_url' => '',
'quantity' => 0,
'quantity_unit' => '',
'reference' => '',
'tax_rate' => 0,
'total_amount' => 0,
'total_discount_amount' => 0,
'total_tax_amount' => 0,
'type' => '',
'unit_price' => 0,
'subscription' => [
'name' => '',
'interval' => '',
'interval_count' => 0
]
]
],
'order_tax_amount' => 0,
'payment_method_categories' => [
[
'asset_urls' => [
'descriptive' => '',
'standard' => ''
],
'identifier' => '',
'name' => ''
]
],
'purchase_country' => '',
'purchase_currency' => '',
'shipping_address' => [
],
'status' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'authorization_token' => '',
'auto_capture' => null,
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'custom_payment_method_ids' => [
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'locale' => '',
'merchant_data' => '',
'merchant_reference1' => '',
'merchant_reference2' => '',
'merchant_urls' => [
'confirmation' => '',
'notification' => '',
'push' => '',
'authorization' => ''
],
'order_amount' => 0,
'order_lines' => [
[
'image_url' => '',
'merchant_data' => '',
'name' => '',
'product_identifiers' => [
'brand' => '',
'category_path' => '',
'global_trade_item_number' => '',
'manufacturer_part_number' => '',
'color' => '',
'size' => ''
],
'product_url' => '',
'quantity' => 0,
'quantity_unit' => '',
'reference' => '',
'tax_rate' => 0,
'total_amount' => 0,
'total_discount_amount' => 0,
'total_tax_amount' => 0,
'type' => '',
'unit_price' => 0,
'subscription' => [
'name' => '',
'interval' => '',
'interval_count' => 0
]
]
],
'order_tax_amount' => 0,
'payment_method_categories' => [
[
'asset_urls' => [
'descriptive' => '',
'standard' => ''
],
'identifier' => '',
'name' => ''
]
],
'purchase_country' => '',
'purchase_currency' => '',
'shipping_address' => [
],
'status' => ''
]));
$request->setRequestUrl('{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"authorization_token": "",
"auto_capture": false,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"authorization_token": "",
"auto_capture": false,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/payments/v1/authorizations/:authorizationToken/order", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order"
payload = {
"authorization_token": "",
"auto_capture": False,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order"
payload <- "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/payments/v1/authorizations/:authorizationToken/order') do |req|
req.body = "{\n \"authorization_token\": \"\",\n \"auto_capture\": false,\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"custom_payment_method_ids\": [],\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"locale\": \"\",\n \"merchant_data\": \"\",\n \"merchant_reference1\": \"\",\n \"merchant_reference2\": \"\",\n \"merchant_urls\": {\n \"confirmation\": \"\",\n \"notification\": \"\",\n \"push\": \"\",\n \"authorization\": \"\"\n },\n \"order_amount\": 0,\n \"order_lines\": [\n {\n \"image_url\": \"\",\n \"merchant_data\": \"\",\n \"name\": \"\",\n \"product_identifiers\": {\n \"brand\": \"\",\n \"category_path\": \"\",\n \"global_trade_item_number\": \"\",\n \"manufacturer_part_number\": \"\",\n \"color\": \"\",\n \"size\": \"\"\n },\n \"product_url\": \"\",\n \"quantity\": 0,\n \"quantity_unit\": \"\",\n \"reference\": \"\",\n \"tax_rate\": 0,\n \"total_amount\": 0,\n \"total_discount_amount\": 0,\n \"total_tax_amount\": 0,\n \"type\": \"\",\n \"unit_price\": 0,\n \"subscription\": {\n \"name\": \"\",\n \"interval\": \"\",\n \"interval_count\": 0\n }\n }\n ],\n \"order_tax_amount\": 0,\n \"payment_method_categories\": [\n {\n \"asset_urls\": {\n \"descriptive\": \"\",\n \"standard\": \"\"\n },\n \"identifier\": \"\",\n \"name\": \"\"\n }\n ],\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\",\n \"shipping_address\": {},\n \"status\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order";
let payload = json!({
"authorization_token": "",
"auto_capture": false,
"billing_address": json!({
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
}),
"custom_payment_method_ids": (),
"customer": json!({
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
}),
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": json!({
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
}),
"order_amount": 0,
"order_lines": (
json!({
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": json!({
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
}),
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": json!({
"name": "",
"interval": "",
"interval_count": 0
})
})
),
"order_tax_amount": 0,
"payment_method_categories": (
json!({
"asset_urls": json!({
"descriptive": "",
"standard": ""
}),
"identifier": "",
"name": ""
})
),
"purchase_country": "",
"purchase_currency": "",
"shipping_address": json!({}),
"status": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/payments/v1/authorizations/:authorizationToken/order \
--header 'content-type: application/json' \
--data '{
"authorization_token": "",
"auto_capture": false,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}'
echo '{
"authorization_token": "",
"auto_capture": false,
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": ""
}' | \
http POST {{baseUrl}}/payments/v1/authorizations/:authorizationToken/order \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "authorization_token": "",\n "auto_capture": false,\n "billing_address": {\n "title": "",\n "attention": "",\n "city": "",\n "country": "",\n "email": "",\n "family_name": "",\n "given_name": "",\n "organization_name": "",\n "phone": "",\n "postal_code": "",\n "region": "",\n "street_address": "",\n "street_address2": ""\n },\n "custom_payment_method_ids": [],\n "customer": {\n "title": "",\n "date_of_birth": "",\n "gender": "",\n "last_four_ssn": "",\n "national_identification_number": "",\n "organization_entity_type": "",\n "organization_registration_id": "",\n "type": "",\n "vat_id": ""\n },\n "locale": "",\n "merchant_data": "",\n "merchant_reference1": "",\n "merchant_reference2": "",\n "merchant_urls": {\n "confirmation": "",\n "notification": "",\n "push": "",\n "authorization": ""\n },\n "order_amount": 0,\n "order_lines": [\n {\n "image_url": "",\n "merchant_data": "",\n "name": "",\n "product_identifiers": {\n "brand": "",\n "category_path": "",\n "global_trade_item_number": "",\n "manufacturer_part_number": "",\n "color": "",\n "size": ""\n },\n "product_url": "",\n "quantity": 0,\n "quantity_unit": "",\n "reference": "",\n "tax_rate": 0,\n "total_amount": 0,\n "total_discount_amount": 0,\n "total_tax_amount": 0,\n "type": "",\n "unit_price": 0,\n "subscription": {\n "name": "",\n "interval": "",\n "interval_count": 0\n }\n }\n ],\n "order_tax_amount": 0,\n "payment_method_categories": [\n {\n "asset_urls": {\n "descriptive": "",\n "standard": ""\n },\n "identifier": "",\n "name": ""\n }\n ],\n "purchase_country": "",\n "purchase_currency": "",\n "shipping_address": {},\n "status": ""\n}' \
--output-document \
- {{baseUrl}}/payments/v1/authorizations/:authorizationToken/order
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"authorization_token": "",
"auto_capture": false,
"billing_address": [
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
],
"custom_payment_method_ids": [],
"customer": [
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
],
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": [
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
],
"order_amount": 0,
"order_lines": [
[
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": [
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
],
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": [
"name": "",
"interval": "",
"interval_count": 0
]
]
],
"order_tax_amount": 0,
"payment_method_categories": [
[
"asset_urls": [
"descriptive": "",
"standard": ""
],
"identifier": "",
"name": ""
]
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": [],
"status": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/order")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"redirect_url": "https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect"
}
POST
Generate a consumer token
{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token
QUERY PARAMS
authorizationToken
BODY json
{
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token" {:content-type :json
:form-params {:description ""
:billing_address {:title ""
:attention ""
:city ""
:country ""
:email ""
:family_name ""
:given_name ""
:organization_name ""
:phone ""
:postal_code ""
:region ""
:street_address ""
:street_address2 ""}
:customer {:title ""
:date_of_birth ""
:gender ""
:last_four_ssn ""
:national_identification_number ""
:organization_entity_type ""
:organization_registration_id ""
:type ""
:vat_id ""}
:intended_use ""
:locale ""
:purchase_country ""
:purchase_currency ""}})
require "http/client"
url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token"),
Content = new StringContent("{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token"
payload := strings.NewReader("{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/payments/v1/authorizations/:authorizationToken/customer-token HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 673
{
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
intended_use: '',
locale: '',
purchase_country: '',
purchase_currency: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token',
headers: {'content-type': 'application/json'},
data: {
description: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
intended_use: '',
locale: '',
purchase_country: '',
purchase_currency: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","billing_address":{"title":"","attention":"","city":"","country":"","email":"","family_name":"","given_name":"","organization_name":"","phone":"","postal_code":"","region":"","street_address":"","street_address2":""},"customer":{"title":"","date_of_birth":"","gender":"","last_four_ssn":"","national_identification_number":"","organization_entity_type":"","organization_registration_id":"","type":"","vat_id":""},"intended_use":"","locale":"","purchase_country":"","purchase_currency":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "billing_address": {\n "title": "",\n "attention": "",\n "city": "",\n "country": "",\n "email": "",\n "family_name": "",\n "given_name": "",\n "organization_name": "",\n "phone": "",\n "postal_code": "",\n "region": "",\n "street_address": "",\n "street_address2": ""\n },\n "customer": {\n "title": "",\n "date_of_birth": "",\n "gender": "",\n "last_four_ssn": "",\n "national_identification_number": "",\n "organization_entity_type": "",\n "organization_registration_id": "",\n "type": "",\n "vat_id": ""\n },\n "intended_use": "",\n "locale": "",\n "purchase_country": "",\n "purchase_currency": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/payments/v1/authorizations/:authorizationToken/customer-token',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
intended_use: '',
locale: '',
purchase_country: '',
purchase_currency: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token',
headers: {'content-type': 'application/json'},
body: {
description: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
intended_use: '',
locale: '',
purchase_country: '',
purchase_currency: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
intended_use: '',
locale: '',
purchase_country: '',
purchase_currency: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token',
headers: {'content-type': 'application/json'},
data: {
description: '',
billing_address: {
title: '',
attention: '',
city: '',
country: '',
email: '',
family_name: '',
given_name: '',
organization_name: '',
phone: '',
postal_code: '',
region: '',
street_address: '',
street_address2: ''
},
customer: {
title: '',
date_of_birth: '',
gender: '',
last_four_ssn: '',
national_identification_number: '',
organization_entity_type: '',
organization_registration_id: '',
type: '',
vat_id: ''
},
intended_use: '',
locale: '',
purchase_country: '',
purchase_currency: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","billing_address":{"title":"","attention":"","city":"","country":"","email":"","family_name":"","given_name":"","organization_name":"","phone":"","postal_code":"","region":"","street_address":"","street_address2":""},"customer":{"title":"","date_of_birth":"","gender":"","last_four_ssn":"","national_identification_number":"","organization_entity_type":"","organization_registration_id":"","type":"","vat_id":""},"intended_use":"","locale":"","purchase_country":"","purchase_currency":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"description": @"",
@"billing_address": @{ @"title": @"", @"attention": @"", @"city": @"", @"country": @"", @"email": @"", @"family_name": @"", @"given_name": @"", @"organization_name": @"", @"phone": @"", @"postal_code": @"", @"region": @"", @"street_address": @"", @"street_address2": @"" },
@"customer": @{ @"title": @"", @"date_of_birth": @"", @"gender": @"", @"last_four_ssn": @"", @"national_identification_number": @"", @"organization_entity_type": @"", @"organization_registration_id": @"", @"type": @"", @"vat_id": @"" },
@"intended_use": @"",
@"locale": @"",
@"purchase_country": @"",
@"purchase_currency": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token",
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([
'description' => '',
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'intended_use' => '',
'locale' => '',
'purchase_country' => '',
'purchase_currency' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token', [
'body' => '{
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'intended_use' => '',
'locale' => '',
'purchase_country' => '',
'purchase_currency' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'billing_address' => [
'title' => '',
'attention' => '',
'city' => '',
'country' => '',
'email' => '',
'family_name' => '',
'given_name' => '',
'organization_name' => '',
'phone' => '',
'postal_code' => '',
'region' => '',
'street_address' => '',
'street_address2' => ''
],
'customer' => [
'title' => '',
'date_of_birth' => '',
'gender' => '',
'last_four_ssn' => '',
'national_identification_number' => '',
'organization_entity_type' => '',
'organization_registration_id' => '',
'type' => '',
'vat_id' => ''
],
'intended_use' => '',
'locale' => '',
'purchase_country' => '',
'purchase_currency' => ''
]));
$request->setRequestUrl('{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/payments/v1/authorizations/:authorizationToken/customer-token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token"
payload = {
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token"
payload <- "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/payments/v1/authorizations/:authorizationToken/customer-token') do |req|
req.body = "{\n \"description\": \"\",\n \"billing_address\": {\n \"title\": \"\",\n \"attention\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"email\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"organization_name\": \"\",\n \"phone\": \"\",\n \"postal_code\": \"\",\n \"region\": \"\",\n \"street_address\": \"\",\n \"street_address2\": \"\"\n },\n \"customer\": {\n \"title\": \"\",\n \"date_of_birth\": \"\",\n \"gender\": \"\",\n \"last_four_ssn\": \"\",\n \"national_identification_number\": \"\",\n \"organization_entity_type\": \"\",\n \"organization_registration_id\": \"\",\n \"type\": \"\",\n \"vat_id\": \"\"\n },\n \"intended_use\": \"\",\n \"locale\": \"\",\n \"purchase_country\": \"\",\n \"purchase_currency\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token";
let payload = json!({
"description": "",
"billing_address": json!({
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
}),
"customer": json!({
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
}),
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token \
--header 'content-type: application/json' \
--data '{
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}'
echo '{
"description": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
}' | \
http POST {{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "billing_address": {\n "title": "",\n "attention": "",\n "city": "",\n "country": "",\n "email": "",\n "family_name": "",\n "given_name": "",\n "organization_name": "",\n "phone": "",\n "postal_code": "",\n "region": "",\n "street_address": "",\n "street_address2": ""\n },\n "customer": {\n "title": "",\n "date_of_birth": "",\n "gender": "",\n "last_four_ssn": "",\n "national_identification_number": "",\n "organization_entity_type": "",\n "organization_registration_id": "",\n "type": "",\n "vat_id": ""\n },\n "intended_use": "",\n "locale": "",\n "purchase_country": "",\n "purchase_currency": ""\n}' \
--output-document \
- {{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"billing_address": [
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
],
"customer": [
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
],
"intended_use": "",
"locale": "",
"purchase_country": "",
"purchase_currency": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/payments/v1/authorizations/:authorizationToken/customer-token")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"customer": {
"date_of_birth": "1978-12-31",
"gender": "male"
},
"payment_method_reference": "0b1d9815-165e-42e2-8867-35bc03789e00",
"redirect_url": "https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect",
"token_id": "0b1d9815-165e-42e2-8867-35bc03789e00"
}
GET
Get details about a session
{{baseUrl}}/payments/v1/sessions/:session_id
QUERY PARAMS
session_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/payments/v1/sessions/:session_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/payments/v1/sessions/:session_id")
require "http/client"
url = "{{baseUrl}}/payments/v1/sessions/:session_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/payments/v1/sessions/:session_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/payments/v1/sessions/:session_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/payments/v1/sessions/:session_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/payments/v1/sessions/:session_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/payments/v1/sessions/:session_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/payments/v1/sessions/:session_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/payments/v1/sessions/:session_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/payments/v1/sessions/:session_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/payments/v1/sessions/:session_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/payments/v1/sessions/:session_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/payments/v1/sessions/:session_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/payments/v1/sessions/:session_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/payments/v1/sessions/:session_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/payments/v1/sessions/:session_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/payments/v1/sessions/:session_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/payments/v1/sessions/:session_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/payments/v1/sessions/:session_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/payments/v1/sessions/:session_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/payments/v1/sessions/:session_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/payments/v1/sessions/:session_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/payments/v1/sessions/:session_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/payments/v1/sessions/:session_id');
echo $response->getBody();
setUrl('{{baseUrl}}/payments/v1/sessions/:session_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/payments/v1/sessions/:session_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/payments/v1/sessions/:session_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/payments/v1/sessions/:session_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/payments/v1/sessions/:session_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/payments/v1/sessions/:session_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/payments/v1/sessions/:session_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/payments/v1/sessions/:session_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/payments/v1/sessions/:session_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/payments/v1/sessions/:session_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/payments/v1/sessions/:session_id
http GET {{baseUrl}}/payments/v1/sessions/:session_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/payments/v1/sessions/:session_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/payments/v1/sessions/:session_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}
POST
Update a session
{{baseUrl}}/payments/v1/sessions/:session_id
QUERY PARAMS
session_id
BODY json
{
"acquiring_channel": "",
"attachment": {
"body": "",
"content_type": ""
},
"authorization_token": "",
"billing_address": {
"title": "",
"attention": "",
"city": "",
"country": "",
"email": "",
"family_name": "",
"given_name": "",
"organization_name": "",
"phone": "",
"postal_code": "",
"region": "",
"street_address": "",
"street_address2": ""
},
"client_token": "",
"custom_payment_method_ids": [],
"customer": {
"title": "",
"date_of_birth": "",
"gender": "",
"last_four_ssn": "",
"national_identification_number": "",
"organization_entity_type": "",
"organization_registration_id": "",
"type": "",
"vat_id": ""
},
"design": "",
"expires_at": "",
"locale": "",
"merchant_data": "",
"merchant_reference1": "",
"merchant_reference2": "",
"merchant_urls": {
"confirmation": "",
"notification": "",
"push": "",
"authorization": ""
},
"options": {
"color_border": "",
"color_border_selected": "",
"color_details": "",
"color_text": "",
"radius_border": ""
},
"order_amount": 0,
"order_lines": [
{
"image_url": "",
"merchant_data": "",
"name": "",
"product_identifiers": {
"brand": "",
"category_path": "",
"global_trade_item_number": "",
"manufacturer_part_number": "",
"color": "",
"size": ""
},
"product_url": "",
"quantity": 0,
"quantity_unit": "",
"reference": "",
"tax_rate": 0,
"total_amount": 0,
"total_discount_amount": 0,
"total_tax_amount": 0,
"type": "",
"unit_price": 0,
"subscription": {
"name": "",
"interval": "",
"interval_count": 0
}
}
],
"order_tax_amount": 0,
"payment_method_categories": [
{
"asset_urls": {
"descriptive": "",
"standard": ""
},
"identifier": "",
"name": ""
}
],
"purchase_country": "",
"purchase_currency": "",
"shipping_address": {},
"status": "",
"intent": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/payments/v1/sessions/:session_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/payments/v1/sessions/:session_id" {:content-type :json
:form-params {:acquiring_channel "ECOMMERCE"
:attachment {:body "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}"
:content_type "application/vnd.klarna.internal.emd-v2+json"}
:billing_address {:title "Mr."
:attention "Attn"
:city "London"
:country "GB"
:email "test.sam@test.com"
:family_name "Andersson"
:given_name "Adam"
:phone "+44795465131"
:postal_code "W1G 0PW"
:region "OH"
:street_address "33 Cavendish Square"
:street_address2 "Floor 22 / Flat 2"}
:client_token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw"
:customer {:title "Mr."
:date_of_birth "1978-12-31"
:gender "male"
:type "organization"}
:expires_at "2038-01-19T03:14:07.000Z"
:locale "en-GB"
:merchant_data "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}"
:merchant_reference1 "ON4711"
:merchant_reference2 "hdt53h-zdgg6-hdaff2"
:merchant_urls {:confirmation "https://www.example-url.com/confirmation"
:notification "https://www.example-url.com/notification"
:push "https://www.example-url.com/push"
:authorization "https://www.example-url.com/authorization"}
:options {:color_border "#FF9900"
:color_border_selected "#FF9900"
:color_details "#FF9900"
:color_text "#FF9900"
:radius_border "5px"}
:order_amount 2000
:order_tax_amount 333
:purchase_country "GB"
:purchase_currency "GBP"
:shipping_address {:title "Mr."
:attention "Attn"
:city "London"
:country "GB"
:email "test.sam@test.com"
:family_name "Andersson"
:given_name "Adam"
:phone "+44795465131"
:postal_code "W1G 0PW"
:region "OH"
:street_address "33 Cavendish Square"
:street_address2 "Floor 22 / Flat 2"}
:status "complete"
:intent "buy"}})
require "http/client"
url = "{{baseUrl}}/payments/v1/sessions/:session_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/payments/v1/sessions/:session_id"),
Content = new StringContent("{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/payments/v1/sessions/:session_id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/payments/v1/sessions/:session_id"
payload := strings.NewReader("{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/payments/v1/sessions/:session_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2156
{
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/payments/v1/sessions/:session_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/payments/v1/sessions/:session_id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/payments/v1/sessions/:session_id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/payments/v1/sessions/:session_id")
.header("content-type", "application/json")
.body("{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}")
.asString();
const data = JSON.stringify({
acquiring_channel: 'ECOMMERCE',
attachment: {
body: '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
content_type: 'application/vnd.klarna.internal.emd-v2+json'
},
billing_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
client_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
customer: {
title: 'Mr.',
date_of_birth: '1978-12-31',
gender: 'male',
type: 'organization'
},
expires_at: '2038-01-19T03:14:07.000Z',
locale: 'en-GB',
merchant_data: '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
merchant_reference1: 'ON4711',
merchant_reference2: 'hdt53h-zdgg6-hdaff2',
merchant_urls: {
confirmation: 'https://www.example-url.com/confirmation',
notification: 'https://www.example-url.com/notification',
push: 'https://www.example-url.com/push',
authorization: 'https://www.example-url.com/authorization'
},
options: {
color_border: '#FF9900',
color_border_selected: '#FF9900',
color_details: '#FF9900',
color_text: '#FF9900',
radius_border: '5px'
},
order_amount: 2000,
order_tax_amount: 333,
purchase_country: 'GB',
purchase_currency: 'GBP',
shipping_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
status: 'complete',
intent: 'buy'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/payments/v1/sessions/:session_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/sessions/:session_id',
headers: {'content-type': 'application/json'},
data: {
acquiring_channel: 'ECOMMERCE',
attachment: {
body: '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
content_type: 'application/vnd.klarna.internal.emd-v2+json'
},
billing_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
client_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
customer: {
title: 'Mr.',
date_of_birth: '1978-12-31',
gender: 'male',
type: 'organization'
},
expires_at: '2038-01-19T03:14:07.000Z',
locale: 'en-GB',
merchant_data: '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
merchant_reference1: 'ON4711',
merchant_reference2: 'hdt53h-zdgg6-hdaff2',
merchant_urls: {
confirmation: 'https://www.example-url.com/confirmation',
notification: 'https://www.example-url.com/notification',
push: 'https://www.example-url.com/push',
authorization: 'https://www.example-url.com/authorization'
},
options: {
color_border: '#FF9900',
color_border_selected: '#FF9900',
color_details: '#FF9900',
color_text: '#FF9900',
radius_border: '5px'
},
order_amount: 2000,
order_tax_amount: 333,
purchase_country: 'GB',
purchase_currency: 'GBP',
shipping_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
status: 'complete',
intent: 'buy'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/payments/v1/sessions/:session_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"acquiring_channel":"ECOMMERCE","attachment":{"body":"{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}","content_type":"application/vnd.klarna.internal.emd-v2+json"},"billing_address":{"title":"Mr.","attention":"Attn","city":"London","country":"GB","email":"test.sam@test.com","family_name":"Andersson","given_name":"Adam","phone":"+44795465131","postal_code":"W1G 0PW","region":"OH","street_address":"33 Cavendish Square","street_address2":"Floor 22 / Flat 2"},"client_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw","customer":{"title":"Mr.","date_of_birth":"1978-12-31","gender":"male","type":"organization"},"expires_at":"2038-01-19T03:14:07.000Z","locale":"en-GB","merchant_data":"{\"order_specific\":[{\"substore\":\"Women\'s Fashion\",\"product_name\":\"Women Sweatshirt\"}]}","merchant_reference1":"ON4711","merchant_reference2":"hdt53h-zdgg6-hdaff2","merchant_urls":{"confirmation":"https://www.example-url.com/confirmation","notification":"https://www.example-url.com/notification","push":"https://www.example-url.com/push","authorization":"https://www.example-url.com/authorization"},"options":{"color_border":"#FF9900","color_border_selected":"#FF9900","color_details":"#FF9900","color_text":"#FF9900","radius_border":"5px"},"order_amount":2000,"order_tax_amount":333,"purchase_country":"GB","purchase_currency":"GBP","shipping_address":{"title":"Mr.","attention":"Attn","city":"London","country":"GB","email":"test.sam@test.com","family_name":"Andersson","given_name":"Adam","phone":"+44795465131","postal_code":"W1G 0PW","region":"OH","street_address":"33 Cavendish Square","street_address2":"Floor 22 / Flat 2"},"status":"complete","intent":"buy"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/payments/v1/sessions/:session_id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "acquiring_channel": "ECOMMERCE",\n "attachment": {\n "body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",\n "content_type": "application/vnd.klarna.internal.emd-v2+json"\n },\n "billing_address": {\n "title": "Mr.",\n "attention": "Attn",\n "city": "London",\n "country": "GB",\n "email": "test.sam@test.com",\n "family_name": "Andersson",\n "given_name": "Adam",\n "phone": "+44795465131",\n "postal_code": "W1G 0PW",\n "region": "OH",\n "street_address": "33 Cavendish Square",\n "street_address2": "Floor 22 / Flat 2"\n },\n "client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",\n "customer": {\n "title": "Mr.",\n "date_of_birth": "1978-12-31",\n "gender": "male",\n "type": "organization"\n },\n "expires_at": "2038-01-19T03:14:07.000Z",\n "locale": "en-GB",\n "merchant_data": "{\"order_specific\":[{\"substore\":\"Women\'s Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",\n "merchant_reference1": "ON4711",\n "merchant_reference2": "hdt53h-zdgg6-hdaff2",\n "merchant_urls": {\n "confirmation": "https://www.example-url.com/confirmation",\n "notification": "https://www.example-url.com/notification",\n "push": "https://www.example-url.com/push",\n "authorization": "https://www.example-url.com/authorization"\n },\n "options": {\n "color_border": "#FF9900",\n "color_border_selected": "#FF9900",\n "color_details": "#FF9900",\n "color_text": "#FF9900",\n "radius_border": "5px"\n },\n "order_amount": 2000,\n "order_tax_amount": 333,\n "purchase_country": "GB",\n "purchase_currency": "GBP",\n "shipping_address": {\n "title": "Mr.",\n "attention": "Attn",\n "city": "London",\n "country": "GB",\n "email": "test.sam@test.com",\n "family_name": "Andersson",\n "given_name": "Adam",\n "phone": "+44795465131",\n "postal_code": "W1G 0PW",\n "region": "OH",\n "street_address": "33 Cavendish Square",\n "street_address2": "Floor 22 / Flat 2"\n },\n "status": "complete",\n "intent": "buy"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/payments/v1/sessions/:session_id")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/payments/v1/sessions/:session_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
acquiring_channel: 'ECOMMERCE',
attachment: {
body: '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
content_type: 'application/vnd.klarna.internal.emd-v2+json'
},
billing_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
client_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
customer: {
title: 'Mr.',
date_of_birth: '1978-12-31',
gender: 'male',
type: 'organization'
},
expires_at: '2038-01-19T03:14:07.000Z',
locale: 'en-GB',
merchant_data: '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
merchant_reference1: 'ON4711',
merchant_reference2: 'hdt53h-zdgg6-hdaff2',
merchant_urls: {
confirmation: 'https://www.example-url.com/confirmation',
notification: 'https://www.example-url.com/notification',
push: 'https://www.example-url.com/push',
authorization: 'https://www.example-url.com/authorization'
},
options: {
color_border: '#FF9900',
color_border_selected: '#FF9900',
color_details: '#FF9900',
color_text: '#FF9900',
radius_border: '5px'
},
order_amount: 2000,
order_tax_amount: 333,
purchase_country: 'GB',
purchase_currency: 'GBP',
shipping_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
status: 'complete',
intent: 'buy'
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/sessions/:session_id',
headers: {'content-type': 'application/json'},
body: {
acquiring_channel: 'ECOMMERCE',
attachment: {
body: '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
content_type: 'application/vnd.klarna.internal.emd-v2+json'
},
billing_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
client_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
customer: {
title: 'Mr.',
date_of_birth: '1978-12-31',
gender: 'male',
type: 'organization'
},
expires_at: '2038-01-19T03:14:07.000Z',
locale: 'en-GB',
merchant_data: '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
merchant_reference1: 'ON4711',
merchant_reference2: 'hdt53h-zdgg6-hdaff2',
merchant_urls: {
confirmation: 'https://www.example-url.com/confirmation',
notification: 'https://www.example-url.com/notification',
push: 'https://www.example-url.com/push',
authorization: 'https://www.example-url.com/authorization'
},
options: {
color_border: '#FF9900',
color_border_selected: '#FF9900',
color_details: '#FF9900',
color_text: '#FF9900',
radius_border: '5px'
},
order_amount: 2000,
order_tax_amount: 333,
purchase_country: 'GB',
purchase_currency: 'GBP',
shipping_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
status: 'complete',
intent: 'buy'
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/payments/v1/sessions/:session_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
acquiring_channel: 'ECOMMERCE',
attachment: {
body: '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
content_type: 'application/vnd.klarna.internal.emd-v2+json'
},
billing_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
client_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
customer: {
title: 'Mr.',
date_of_birth: '1978-12-31',
gender: 'male',
type: 'organization'
},
expires_at: '2038-01-19T03:14:07.000Z',
locale: 'en-GB',
merchant_data: '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
merchant_reference1: 'ON4711',
merchant_reference2: 'hdt53h-zdgg6-hdaff2',
merchant_urls: {
confirmation: 'https://www.example-url.com/confirmation',
notification: 'https://www.example-url.com/notification',
push: 'https://www.example-url.com/push',
authorization: 'https://www.example-url.com/authorization'
},
options: {
color_border: '#FF9900',
color_border_selected: '#FF9900',
color_details: '#FF9900',
color_text: '#FF9900',
radius_border: '5px'
},
order_amount: 2000,
order_tax_amount: 333,
purchase_country: 'GB',
purchase_currency: 'GBP',
shipping_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
status: 'complete',
intent: 'buy'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/payments/v1/sessions/:session_id',
headers: {'content-type': 'application/json'},
data: {
acquiring_channel: 'ECOMMERCE',
attachment: {
body: '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
content_type: 'application/vnd.klarna.internal.emd-v2+json'
},
billing_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
client_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
customer: {
title: 'Mr.',
date_of_birth: '1978-12-31',
gender: 'male',
type: 'organization'
},
expires_at: '2038-01-19T03:14:07.000Z',
locale: 'en-GB',
merchant_data: '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
merchant_reference1: 'ON4711',
merchant_reference2: 'hdt53h-zdgg6-hdaff2',
merchant_urls: {
confirmation: 'https://www.example-url.com/confirmation',
notification: 'https://www.example-url.com/notification',
push: 'https://www.example-url.com/push',
authorization: 'https://www.example-url.com/authorization'
},
options: {
color_border: '#FF9900',
color_border_selected: '#FF9900',
color_details: '#FF9900',
color_text: '#FF9900',
radius_border: '5px'
},
order_amount: 2000,
order_tax_amount: 333,
purchase_country: 'GB',
purchase_currency: 'GBP',
shipping_address: {
title: 'Mr.',
attention: 'Attn',
city: 'London',
country: 'GB',
email: 'test.sam@test.com',
family_name: 'Andersson',
given_name: 'Adam',
phone: '+44795465131',
postal_code: 'W1G 0PW',
region: 'OH',
street_address: '33 Cavendish Square',
street_address2: 'Floor 22 / Flat 2'
},
status: 'complete',
intent: 'buy'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/payments/v1/sessions/:session_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"acquiring_channel":"ECOMMERCE","attachment":{"body":"{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}","content_type":"application/vnd.klarna.internal.emd-v2+json"},"billing_address":{"title":"Mr.","attention":"Attn","city":"London","country":"GB","email":"test.sam@test.com","family_name":"Andersson","given_name":"Adam","phone":"+44795465131","postal_code":"W1G 0PW","region":"OH","street_address":"33 Cavendish Square","street_address2":"Floor 22 / Flat 2"},"client_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw","customer":{"title":"Mr.","date_of_birth":"1978-12-31","gender":"male","type":"organization"},"expires_at":"2038-01-19T03:14:07.000Z","locale":"en-GB","merchant_data":"{\"order_specific\":[{\"substore\":\"Women\'s Fashion\",\"product_name\":\"Women Sweatshirt\"}]}","merchant_reference1":"ON4711","merchant_reference2":"hdt53h-zdgg6-hdaff2","merchant_urls":{"confirmation":"https://www.example-url.com/confirmation","notification":"https://www.example-url.com/notification","push":"https://www.example-url.com/push","authorization":"https://www.example-url.com/authorization"},"options":{"color_border":"#FF9900","color_border_selected":"#FF9900","color_details":"#FF9900","color_text":"#FF9900","radius_border":"5px"},"order_amount":2000,"order_tax_amount":333,"purchase_country":"GB","purchase_currency":"GBP","shipping_address":{"title":"Mr.","attention":"Attn","city":"London","country":"GB","email":"test.sam@test.com","family_name":"Andersson","given_name":"Adam","phone":"+44795465131","postal_code":"W1G 0PW","region":"OH","street_address":"33 Cavendish Square","street_address2":"Floor 22 / Flat 2"},"status":"complete","intent":"buy"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"acquiring_channel": @"ECOMMERCE",
@"attachment": @{ @"body": @"{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}", @"content_type": @"application/vnd.klarna.internal.emd-v2+json" },
@"billing_address": @{ @"title": @"Mr.", @"attention": @"Attn", @"city": @"London", @"country": @"GB", @"email": @"test.sam@test.com", @"family_name": @"Andersson", @"given_name": @"Adam", @"phone": @"+44795465131", @"postal_code": @"W1G 0PW", @"region": @"OH", @"street_address": @"33 Cavendish Square", @"street_address2": @"Floor 22 / Flat 2" },
@"client_token": @"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
@"customer": @{ @"title": @"Mr.", @"date_of_birth": @"1978-12-31", @"gender": @"male", @"type": @"organization" },
@"expires_at": @"2038-01-19T03:14:07.000Z",
@"locale": @"en-GB",
@"merchant_data": @"{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
@"merchant_reference1": @"ON4711",
@"merchant_reference2": @"hdt53h-zdgg6-hdaff2",
@"merchant_urls": @{ @"confirmation": @"https://www.example-url.com/confirmation", @"notification": @"https://www.example-url.com/notification", @"push": @"https://www.example-url.com/push", @"authorization": @"https://www.example-url.com/authorization" },
@"options": @{ @"color_border": @"#FF9900", @"color_border_selected": @"#FF9900", @"color_details": @"#FF9900", @"color_text": @"#FF9900", @"radius_border": @"5px" },
@"order_amount": @2000,
@"order_tax_amount": @333,
@"purchase_country": @"GB",
@"purchase_currency": @"GBP",
@"shipping_address": @{ @"title": @"Mr.", @"attention": @"Attn", @"city": @"London", @"country": @"GB", @"email": @"test.sam@test.com", @"family_name": @"Andersson", @"given_name": @"Adam", @"phone": @"+44795465131", @"postal_code": @"W1G 0PW", @"region": @"OH", @"street_address": @"33 Cavendish Square", @"street_address2": @"Floor 22 / Flat 2" },
@"status": @"complete",
@"intent": @"buy" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/payments/v1/sessions/:session_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/payments/v1/sessions/:session_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/payments/v1/sessions/:session_id",
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([
'acquiring_channel' => 'ECOMMERCE',
'attachment' => [
'body' => '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
'content_type' => 'application/vnd.klarna.internal.emd-v2+json'
],
'billing_address' => [
'title' => 'Mr.',
'attention' => 'Attn',
'city' => 'London',
'country' => 'GB',
'email' => 'test.sam@test.com',
'family_name' => 'Andersson',
'given_name' => 'Adam',
'phone' => '+44795465131',
'postal_code' => 'W1G 0PW',
'region' => 'OH',
'street_address' => '33 Cavendish Square',
'street_address2' => 'Floor 22 / Flat 2'
],
'client_token' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
'customer' => [
'title' => 'Mr.',
'date_of_birth' => '1978-12-31',
'gender' => 'male',
'type' => 'organization'
],
'expires_at' => '2038-01-19T03:14:07.000Z',
'locale' => 'en-GB',
'merchant_data' => '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
'merchant_reference1' => 'ON4711',
'merchant_reference2' => 'hdt53h-zdgg6-hdaff2',
'merchant_urls' => [
'confirmation' => 'https://www.example-url.com/confirmation',
'notification' => 'https://www.example-url.com/notification',
'push' => 'https://www.example-url.com/push',
'authorization' => 'https://www.example-url.com/authorization'
],
'options' => [
'color_border' => '#FF9900',
'color_border_selected' => '#FF9900',
'color_details' => '#FF9900',
'color_text' => '#FF9900',
'radius_border' => '5px'
],
'order_amount' => 2000,
'order_tax_amount' => 333,
'purchase_country' => 'GB',
'purchase_currency' => 'GBP',
'shipping_address' => [
'title' => 'Mr.',
'attention' => 'Attn',
'city' => 'London',
'country' => 'GB',
'email' => 'test.sam@test.com',
'family_name' => 'Andersson',
'given_name' => 'Adam',
'phone' => '+44795465131',
'postal_code' => 'W1G 0PW',
'region' => 'OH',
'street_address' => '33 Cavendish Square',
'street_address2' => 'Floor 22 / Flat 2'
],
'status' => 'complete',
'intent' => 'buy'
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/payments/v1/sessions/:session_id', [
'body' => '{
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\\"customer_account_info\\":[{\\"unique_account_identifier\\":\\"test@gmail.com\\",\\"account_registration_date\\":\\"2017-02-13T10:49:20Z\\",\\"account_last_modified\\":\\"2019-03-13T11:45:27Z\\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\\"order_specific\\":[{\\"substore\\":\\"Women\'s Fashion\\",\\"product_name\\":\\"Women Sweatshirt\\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/payments/v1/sessions/:session_id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'acquiring_channel' => 'ECOMMERCE',
'attachment' => [
'body' => '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
'content_type' => 'application/vnd.klarna.internal.emd-v2+json'
],
'billing_address' => [
'title' => 'Mr.',
'attention' => 'Attn',
'city' => 'London',
'country' => 'GB',
'email' => 'test.sam@test.com',
'family_name' => 'Andersson',
'given_name' => 'Adam',
'phone' => '+44795465131',
'postal_code' => 'W1G 0PW',
'region' => 'OH',
'street_address' => '33 Cavendish Square',
'street_address2' => 'Floor 22 / Flat 2'
],
'client_token' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
'customer' => [
'title' => 'Mr.',
'date_of_birth' => '1978-12-31',
'gender' => 'male',
'type' => 'organization'
],
'expires_at' => '2038-01-19T03:14:07.000Z',
'locale' => 'en-GB',
'merchant_data' => '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
'merchant_reference1' => 'ON4711',
'merchant_reference2' => 'hdt53h-zdgg6-hdaff2',
'merchant_urls' => [
'confirmation' => 'https://www.example-url.com/confirmation',
'notification' => 'https://www.example-url.com/notification',
'push' => 'https://www.example-url.com/push',
'authorization' => 'https://www.example-url.com/authorization'
],
'options' => [
'color_border' => '#FF9900',
'color_border_selected' => '#FF9900',
'color_details' => '#FF9900',
'color_text' => '#FF9900',
'radius_border' => '5px'
],
'order_amount' => 2000,
'order_tax_amount' => 333,
'purchase_country' => 'GB',
'purchase_currency' => 'GBP',
'shipping_address' => [
'title' => 'Mr.',
'attention' => 'Attn',
'city' => 'London',
'country' => 'GB',
'email' => 'test.sam@test.com',
'family_name' => 'Andersson',
'given_name' => 'Adam',
'phone' => '+44795465131',
'postal_code' => 'W1G 0PW',
'region' => 'OH',
'street_address' => '33 Cavendish Square',
'street_address2' => 'Floor 22 / Flat 2'
],
'status' => 'complete',
'intent' => 'buy'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'acquiring_channel' => 'ECOMMERCE',
'attachment' => [
'body' => '{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}',
'content_type' => 'application/vnd.klarna.internal.emd-v2+json'
],
'billing_address' => [
'title' => 'Mr.',
'attention' => 'Attn',
'city' => 'London',
'country' => 'GB',
'email' => 'test.sam@test.com',
'family_name' => 'Andersson',
'given_name' => 'Adam',
'phone' => '+44795465131',
'postal_code' => 'W1G 0PW',
'region' => 'OH',
'street_address' => '33 Cavendish Square',
'street_address2' => 'Floor 22 / Flat 2'
],
'client_token' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw',
'customer' => [
'title' => 'Mr.',
'date_of_birth' => '1978-12-31',
'gender' => 'male',
'type' => 'organization'
],
'expires_at' => '2038-01-19T03:14:07.000Z',
'locale' => 'en-GB',
'merchant_data' => '{"order_specific":[{"substore":"Women\'s Fashion","product_name":"Women Sweatshirt"}]}',
'merchant_reference1' => 'ON4711',
'merchant_reference2' => 'hdt53h-zdgg6-hdaff2',
'merchant_urls' => [
'confirmation' => 'https://www.example-url.com/confirmation',
'notification' => 'https://www.example-url.com/notification',
'push' => 'https://www.example-url.com/push',
'authorization' => 'https://www.example-url.com/authorization'
],
'options' => [
'color_border' => '#FF9900',
'color_border_selected' => '#FF9900',
'color_details' => '#FF9900',
'color_text' => '#FF9900',
'radius_border' => '5px'
],
'order_amount' => 2000,
'order_tax_amount' => 333,
'purchase_country' => 'GB',
'purchase_currency' => 'GBP',
'shipping_address' => [
'title' => 'Mr.',
'attention' => 'Attn',
'city' => 'London',
'country' => 'GB',
'email' => 'test.sam@test.com',
'family_name' => 'Andersson',
'given_name' => 'Adam',
'phone' => '+44795465131',
'postal_code' => 'W1G 0PW',
'region' => 'OH',
'street_address' => '33 Cavendish Square',
'street_address2' => 'Floor 22 / Flat 2'
],
'status' => 'complete',
'intent' => 'buy'
]));
$request->setRequestUrl('{{baseUrl}}/payments/v1/sessions/:session_id');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/payments/v1/sessions/:session_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/payments/v1/sessions/:session_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/payments/v1/sessions/:session_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/payments/v1/sessions/:session_id"
payload = {
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/payments/v1/sessions/:session_id"
payload <- "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/payments/v1/sessions/:session_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/payments/v1/sessions/:session_id') do |req|
req.body = "{\n \"acquiring_channel\": \"ECOMMERCE\",\n \"attachment\": {\n \"body\": \"{\\\"customer_account_info\\\":[{\\\"unique_account_identifier\\\":\\\"test@gmail.com\\\",\\\"account_registration_date\\\":\\\"2017-02-13T10:49:20Z\\\",\\\"account_last_modified\\\":\\\"2019-03-13T11:45:27Z\\\"}]}\",\n \"content_type\": \"application/vnd.klarna.internal.emd-v2+json\"\n },\n \"billing_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"client_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw\",\n \"customer\": {\n \"title\": \"Mr.\",\n \"date_of_birth\": \"1978-12-31\",\n \"gender\": \"male\",\n \"type\": \"organization\"\n },\n \"expires_at\": \"2038-01-19T03:14:07.000Z\",\n \"locale\": \"en-GB\",\n \"merchant_data\": \"{\\\"order_specific\\\":[{\\\"substore\\\":\\\"Women's Fashion\\\",\\\"product_name\\\":\\\"Women Sweatshirt\\\"}]}\",\n \"merchant_reference1\": \"ON4711\",\n \"merchant_reference2\": \"hdt53h-zdgg6-hdaff2\",\n \"merchant_urls\": {\n \"confirmation\": \"https://www.example-url.com/confirmation\",\n \"notification\": \"https://www.example-url.com/notification\",\n \"push\": \"https://www.example-url.com/push\",\n \"authorization\": \"https://www.example-url.com/authorization\"\n },\n \"options\": {\n \"color_border\": \"#FF9900\",\n \"color_border_selected\": \"#FF9900\",\n \"color_details\": \"#FF9900\",\n \"color_text\": \"#FF9900\",\n \"radius_border\": \"5px\"\n },\n \"order_amount\": 2000,\n \"order_tax_amount\": 333,\n \"purchase_country\": \"GB\",\n \"purchase_currency\": \"GBP\",\n \"shipping_address\": {\n \"title\": \"Mr.\",\n \"attention\": \"Attn\",\n \"city\": \"London\",\n \"country\": \"GB\",\n \"email\": \"test.sam@test.com\",\n \"family_name\": \"Andersson\",\n \"given_name\": \"Adam\",\n \"phone\": \"+44795465131\",\n \"postal_code\": \"W1G 0PW\",\n \"region\": \"OH\",\n \"street_address\": \"33 Cavendish Square\",\n \"street_address2\": \"Floor 22 / Flat 2\"\n },\n \"status\": \"complete\",\n \"intent\": \"buy\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/payments/v1/sessions/:session_id";
let payload = json!({
"acquiring_channel": "ECOMMERCE",
"attachment": json!({
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
}),
"billing_address": json!({
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
}),
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": json!({
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
}),
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": json!({
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
}),
"options": json!({
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
}),
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": json!({
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
}),
"status": "complete",
"intent": "buy"
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/payments/v1/sessions/:session_id \
--header 'content-type: application/json' \
--data '{
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women'\''s Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}'
echo '{
"acquiring_channel": "ECOMMERCE",
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"billing_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": {
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women'\''s Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": {
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": {
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
},
"status": "complete",
"intent": "buy"
}' | \
http POST {{baseUrl}}/payments/v1/sessions/:session_id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "acquiring_channel": "ECOMMERCE",\n "attachment": {\n "body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",\n "content_type": "application/vnd.klarna.internal.emd-v2+json"\n },\n "billing_address": {\n "title": "Mr.",\n "attention": "Attn",\n "city": "London",\n "country": "GB",\n "email": "test.sam@test.com",\n "family_name": "Andersson",\n "given_name": "Adam",\n "phone": "+44795465131",\n "postal_code": "W1G 0PW",\n "region": "OH",\n "street_address": "33 Cavendish Square",\n "street_address2": "Floor 22 / Flat 2"\n },\n "client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",\n "customer": {\n "title": "Mr.",\n "date_of_birth": "1978-12-31",\n "gender": "male",\n "type": "organization"\n },\n "expires_at": "2038-01-19T03:14:07.000Z",\n "locale": "en-GB",\n "merchant_data": "{\"order_specific\":[{\"substore\":\"Women'\''s Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",\n "merchant_reference1": "ON4711",\n "merchant_reference2": "hdt53h-zdgg6-hdaff2",\n "merchant_urls": {\n "confirmation": "https://www.example-url.com/confirmation",\n "notification": "https://www.example-url.com/notification",\n "push": "https://www.example-url.com/push",\n "authorization": "https://www.example-url.com/authorization"\n },\n "options": {\n "color_border": "#FF9900",\n "color_border_selected": "#FF9900",\n "color_details": "#FF9900",\n "color_text": "#FF9900",\n "radius_border": "5px"\n },\n "order_amount": 2000,\n "order_tax_amount": 333,\n "purchase_country": "GB",\n "purchase_currency": "GBP",\n "shipping_address": {\n "title": "Mr.",\n "attention": "Attn",\n "city": "London",\n "country": "GB",\n "email": "test.sam@test.com",\n "family_name": "Andersson",\n "given_name": "Adam",\n "phone": "+44795465131",\n "postal_code": "W1G 0PW",\n "region": "OH",\n "street_address": "33 Cavendish Square",\n "street_address2": "Floor 22 / Flat 2"\n },\n "status": "complete",\n "intent": "buy"\n}' \
--output-document \
- {{baseUrl}}/payments/v1/sessions/:session_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"acquiring_channel": "ECOMMERCE",
"attachment": [
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
],
"billing_address": [
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
],
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"customer": [
"title": "Mr.",
"date_of_birth": "1978-12-31",
"gender": "male",
"type": "organization"
],
"expires_at": "2038-01-19T03:14:07.000Z",
"locale": "en-GB",
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "hdt53h-zdgg6-hdaff2",
"merchant_urls": [
"confirmation": "https://www.example-url.com/confirmation",
"notification": "https://www.example-url.com/notification",
"push": "https://www.example-url.com/push",
"authorization": "https://www.example-url.com/authorization"
],
"options": [
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
],
"order_amount": 2000,
"order_tax_amount": 333,
"purchase_country": "GB",
"purchase_currency": "GBP",
"shipping_address": [
"title": "Mr.",
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2"
],
"status": "complete",
"intent": "buy"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/payments/v1/sessions/:session_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()