Criar checkout
curl --request POST \
--url https://api.pagstack.com/v1/checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"description": "<string>",
"plan": "<string>",
"payment_methods": [
"pix"
],
"success_url": "<string>",
"cancel_url": "<string>",
"external_id": "<string>",
"buyer": {
"name": "<string>",
"email": "jsmith@example.com",
"tax_id": "<string>"
},
"expires_in": 302550,
"metadata": {},
"bucket": "<string>",
"tracking": {
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"src": "<string>",
"sck": "<string>"
},
"allow_coupons": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
description: '<string>',
plan: '<string>',
payment_methods: ['pix'],
success_url: '<string>',
cancel_url: '<string>',
external_id: '<string>',
buyer: {name: '<string>', email: 'jsmith@example.com', tax_id: '<string>'},
expires_in: 302550,
metadata: {},
bucket: '<string>',
tracking: {
utm_source: '<string>',
utm_medium: '<string>',
utm_campaign: '<string>',
utm_content: '<string>',
utm_term: '<string>',
src: '<string>',
sck: '<string>'
},
allow_coupons: true
})
};
fetch('https://api.pagstack.com/v1/checkouts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pagstack.com/v1/checkouts"
payload = {
"amount": 123,
"description": "<string>",
"plan": "<string>",
"payment_methods": ["pix"],
"success_url": "<string>",
"cancel_url": "<string>",
"external_id": "<string>",
"buyer": {
"name": "<string>",
"email": "jsmith@example.com",
"tax_id": "<string>"
},
"expires_in": 302550,
"metadata": {},
"bucket": "<string>",
"tracking": {
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"src": "<string>",
"sck": "<string>"
},
"allow_coupons": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "checkout",
"livemode": true,
"status": "open",
"url": "<string>",
"amount": 0,
"description": "<string>",
"payment_methods": [
"pix"
],
"external_id": "<string>",
"buyer": {
"name": "<string>",
"email": "<string>",
"tax_id": "<string>",
"phone": "<string>"
},
"success_url": "<string>",
"cancel_url": "<string>",
"transaction_id": "<string>",
"plan": "<string>",
"subscription_id": "<string>",
"bucket": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
},
"tracking": {},
"order_bump": {
"productId": "<string>",
"name": "<string>",
"amount": 0,
"accepted": true
},
"allow_coupons": true,
"coupon": {
"id": "<string>",
"code": "<string>"
},
"metadata": {},
"expires_at": "<string>",
"completed_at": "<string>",
"created_at": "<string>"
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Checkout
Criar checkout
Cria uma página de pagamento hospedada pela Pagstack. Mande o cliente para url; quando ele pagar, você recebe checkout.completed.
Criar checkout
curl --request POST \
--url https://api.pagstack.com/v1/checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"description": "<string>",
"plan": "<string>",
"payment_methods": [
"pix"
],
"success_url": "<string>",
"cancel_url": "<string>",
"external_id": "<string>",
"buyer": {
"name": "<string>",
"email": "jsmith@example.com",
"tax_id": "<string>"
},
"expires_in": 302550,
"metadata": {},
"bucket": "<string>",
"tracking": {
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"src": "<string>",
"sck": "<string>"
},
"allow_coupons": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
description: '<string>',
plan: '<string>',
payment_methods: ['pix'],
success_url: '<string>',
cancel_url: '<string>',
external_id: '<string>',
buyer: {name: '<string>', email: 'jsmith@example.com', tax_id: '<string>'},
expires_in: 302550,
metadata: {},
bucket: '<string>',
tracking: {
utm_source: '<string>',
utm_medium: '<string>',
utm_campaign: '<string>',
utm_content: '<string>',
utm_term: '<string>',
src: '<string>',
sck: '<string>'
},
allow_coupons: true
})
};
fetch('https://api.pagstack.com/v1/checkouts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pagstack.com/v1/checkouts"
payload = {
"amount": 123,
"description": "<string>",
"plan": "<string>",
"payment_methods": ["pix"],
"success_url": "<string>",
"cancel_url": "<string>",
"external_id": "<string>",
"buyer": {
"name": "<string>",
"email": "jsmith@example.com",
"tax_id": "<string>"
},
"expires_in": 302550,
"metadata": {},
"bucket": "<string>",
"tracking": {
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"src": "<string>",
"sck": "<string>"
},
"allow_coupons": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "checkout",
"livemode": true,
"status": "open",
"url": "<string>",
"amount": 0,
"description": "<string>",
"payment_methods": [
"pix"
],
"external_id": "<string>",
"buyer": {
"name": "<string>",
"email": "<string>",
"tax_id": "<string>",
"phone": "<string>"
},
"success_url": "<string>",
"cancel_url": "<string>",
"transaction_id": "<string>",
"plan": "<string>",
"subscription_id": "<string>",
"bucket": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
},
"tracking": {},
"order_bump": {
"productId": "<string>",
"name": "<string>",
"amount": 0,
"accepted": true
},
"allow_coupons": true,
"coupon": {
"id": "<string>",
"code": "<string>"
},
"metadata": {},
"expires_at": "<string>",
"completed_at": "<string>",
"created_at": "<string>"
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Autorizações
Cabeçalhos
Corpo
application/json
Resposta
Sucesso.
Checkout: página de pagamento hospedada pela Pagstack.