Embed in mobile application
The checkout can be embedded in mobile applications using the "Webview" component and the "Deep linking" mechanism available on Android and iOS.
Useful references:
- https://developer.android.com/training/app-links/deep-linking
 - https://blog.devgenius.io/deep-linking-in-ios-f5bfa2959d0a
 - https://en.yeeply.com/blog/deep-linking-android-ios-apps/
 
The process works as follows:
- (Back-end) Generate the checkout link using the /checkouts resource;
 - (Application) Open the previously obtained link in the Android/iOS webview;
 - (Webview) Wait for the user to complete the payment;
 - (Application) The user has returned to the application;
 - (Back-end) Check the status of the checkout via the API;
 - (Application) Display the application view accordingly;
 
Generating the checkout link for Webview
The parameter redirects of type action must contain the URL "Deep link" will invoke the application after payment.
- 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": "default" // <== Incorporado
	},
	"redirects": [
		{
			"type": "action",
			"url": "https://www.myapp.com" // <== URL deep Link
		}
	]
}
{
	"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=default",
		"paymentId": "42690",
		"stateDetails": {
			"state": "PaymentReady",
			"timestamp": "2022-01-03T14:16:17+00:00"
		}
	}
}