Retrieve a checkout
curl --request GET \
--url https://api.cope.com/v1/commerce/checkouts/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cope.com/v1/commerce/checkouts/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cope.com/v1/commerce/checkouts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cope.com/v1/commerce/checkouts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cope.com/v1/commerce/checkouts/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cope.com/v1/commerce/checkouts/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/checkouts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"buyer_email_locked": true,
"cancel_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"external_reference": "<string>",
"id": "chk_A1b2C3d4E5f6G7h8",
"metadata": {},
"object": "checkout",
"order": {
"id": "ord_A1b2C3d4E5f6",
"object": "order"
},
"status": "open",
"success_url": "<string>",
"totals": {
"currency": "<string>",
"discount_minor_units": 123,
"shipping_minor_units": 123,
"subtotal_minor_units": 123,
"tax_minor_units": 123,
"total_minor_units": 123
},
"checkout_url": "<string>",
"embed_origin": "<string>",
"embed_url": "<string>"
}
}
Retrieve a checkout
Returns a checkout you created. order names the order the buyer’s payment made once it
succeeded, and is null until then; status reads completed whenever order is set. A
checkout expires 30 minutes after it was created.
Requires the orders permission at read. An API key holds a permission at the lower of its own level (read for a read-only key) and its holder’s role; a key without it is refused with 403.
GET
/
v1
/
commerce
/
checkouts
/
{id}
Retrieve a checkout
curl --request GET \
--url https://api.cope.com/v1/commerce/checkouts/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cope.com/v1/commerce/checkouts/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cope.com/v1/commerce/checkouts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cope.com/v1/commerce/checkouts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cope.com/v1/commerce/checkouts/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cope.com/v1/commerce/checkouts/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/checkouts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"buyer_email_locked": true,
"cancel_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"external_reference": "<string>",
"id": "chk_A1b2C3d4E5f6G7h8",
"metadata": {},
"object": "checkout",
"order": {
"id": "ord_A1b2C3d4E5f6",
"object": "order"
},
"status": "open",
"success_url": "<string>",
"totals": {
"currency": "<string>",
"discount_minor_units": 123,
"shipping_minor_units": 123,
"subtotal_minor_units": 123,
"tax_minor_units": 123,
"total_minor_units": 123
},
"checkout_url": "<string>",
"embed_origin": "<string>",
"embed_url": "<string>"
}
}
Authorizations
Bearer credential for the public API: a live COPE API key (ck_live_*; keys issued earlier as cope_sk_live_* keep working). Dashboard sign-in tokens are not accepted.
Path Parameters
id public identifier.
Pattern:
^chk_[A-Za-z0-9]{8,32}$Example:
"chk_A1b2C3d4E5f6G7h8"
Response
Successful response
Show child attributes
Show child attributes
Was this page helpful?