Embed in webpage
To get the embed link, you must make a POST /checkouts request with the desired data.
The parameterredirects
of type
action
is required and must contain the URL to which the customer will be redirected after the payment is processed.
The checkout id parameter is automatically appended to the URL at the moment of redirection.
{
	...
	"redirects": [
		{
			"type": "action", // <== Redireccionamento obrigatório
			"url": "https://www.url-action.dominio"
		}
	]
}
- Language: Português
 - Page layout: Incorporado
 - Amount: 5€
 - Payment method: Cartão de Crédito/Débito (CC)
 - Product code: REFPRODUTO_1
 - Product description: Computador
 - Customer:
- Customer number: 1
 - First name: José
 - Last name: Silva
 - Phone: 351#961234567
 - Email: jose.silva@email.com
 
 - Invoicing address:
- Country: Portugal
 - City: Lisboa
 - Address: Rua Domingos Monteiro nº 7 A,
 - Postcode: 1050-074
 
 - Redirects:
- After payment: https://www.url-action.dominio
 
 
- Request
 - Response
 
POST /checkouts
{
	"payment": {
		"amount": 500,
		"code": "REFPRODUTO_1",
		"summary": "Computador",
		"customer": {
			"customerId": "1",
			"firstName": "José",
			"lastName": "Silva",
			"phoneNumber": "351#961234567",
			"email": "jose.silva@email.com"
		},
		"billingAddress": {
			"country": "PT",
			"city": "Lisboa",
			"street1": "Rua Domingos Monteiro nº 7 A",
			"postCode": "1050-074"
		},
		"paymentMethod": {
			"code": "CC" // <== Método de pagamento
		}
	},
	"page": {
		"language": "PT",
		"layout": "embed" // <== Incorporado
	},
	"redirects": [
		{
			"type": "action", // <== Redireccionamento obrigatório
			"url": "https://www.url-action.dominio"
		}
	]
}
{
	"apiVersion": "1.0",
	"date": "2022-01-03T14:16:17+00:00",
	"success": true,
	"data": {
		"id": "0uJQvNoxoloZCn4gyuGKIWR8dtU9OnAm0emxYWcb",
		"createdAt": "2022-01-03 14:16:17",
		"checkoutUrl": "https://paypay.pt/paypay/checkout/v2/embed/0uJQvNoxoloZCn4gyuGKIWR8dtU9OnAm0emxYWcb?page_layout=embed",
		"paymentId": "42690",
		"stateDetails": {
			"state": "PaymentReady",
			"timestamp": "2022-01-03T14:16:17+00:00"
		}
	}
}
To create the payment form, simply add the following HTML/JavaScript lines to your page.
The {id} must be replaced with the id returned in the request response; in the previous example it would be 0uJQvNoxoloZCn4gyuGKIWR8dtU9OnAm0emxYWcb.
<form class="paymentWidgets"></form>
<script src="https://paypay.pt/paypay/checkout/v2/embed/{id}?page_layout=embed"></script>