Pular para o conteúdo principal
Nesta página

Esta página inclui as etapas necessárias para integrar o PSE usando a API DEUNA.

Use a Ponto final V2 para integrações diretas de API.

Compra V2#

As compras V2 executam as duas etapas em um único endpoint, adicionando as informações do pedido na solicitação.

O processo de compra V2 é o seguinte:

  1. Chamadas de usuário POST v2/merchants/order/purchase com as informações do pedido na solicitação CURL.
  2. A DEUNA cria o pedido e realiza a operação de compra.

Integrar PSE por API#

As integrações diretas de API seguem o processo V2.

1. Obtenha bancos disponíveis

Como pré-requisito para realizar uma Compra, o usuário deverá selecionar o banco onde realizará a transação.

Faça uma solicitação ao Ponto de extremidade das formas de pagamento do comerciante para obter as informações.

O objeto de resposta resultante terá a seguinte estrutura:

JSON
{
  "@type": "type.googleapis.com/external_merchant_api.v1.GetPaymentMethodsResponse",
  "data": [
    {
      "enabled": true,
      "method_type": "bank_transfer",
      "processor_name": "payu_pse",
      "specific_fields": {
        "financial_institutions": [
          {
            "id": "1081",
            "description": "BANCO AGRARIO DESARROLLO",
            "url": ""
          },
          {
            "id": "1813",
            "description": "SANTANDER CONSUMER COLOMBIA",
            "url": ""
          }
        ]
      },
      "input_schema": [],
      "labels": {
        "es": ""
      },
      "exclude_cvv": false,
      "excluded_franchises": [],
      "extra_params": {},
      "installments": [],
      "credentials": {
        "public_api_key": "",
        "external_merchant_id": "",
        "customer_token": ""
      },
      "google_pay_credential": null,
      "stored_payment_methods": [],
      "id": "00000000-0000-0000-0000-000000000000",
      "payment_centers": [],
      "payment_provider": ""
    }
  ]
}

Dentro do specific_fields objeto, existe um objeto chamado financial_institutions contendo uma matriz de objetos com a seguinte estrutura:

JSON
{
  "id": "1813",
  "description": "SANTANDER CONSUMER COLOMBIA",
  "url": ""
}

Como enviar as informações para o usuário?

Certifique-se de gerar a matriz de objetos usando o description campo como o rótulo. Depois que o usuário selecionar uma opção, certifique-se de que o id e description campos para preencher os dados bancários necessários para a Compra.

2. Faça uma compra PSE V2

Faça uma solicitação ao Compra V2 endpoint.

Para fazer uma compra de PSE com Deuna, a carga V2 deve conter o seguinte:

  • Os dados do pedido devem incluir as informações do pedido.
  • Nome completo
  • Número do documento
  • Tipo de documento
  • Número de telefone
  • Tipo de pessoa (física ou jurídica)
  • Banco
  • URL de retorno de chamada para redirecionar o usuário para sua página

Esta tabela mostra os campos necessários para realizar uma transação PSE:

CampoDescriçãoExemplo
payer_infor.person_typeTipo de pessoa, física ou jurídica.LEGAL_PERSON
pse.financial_institutionCódigo do banco selecionado.1022
pse.financial_institution_nameNome do banco.BANCO UNION COLOMBIANO
callback_urls.on_successURL de redirecionamento após concluir a transação PSE.https://example.com/
browser_details.ip_addressEndereço IP do navegador usado pelo usuário.155.95.122.206
billing_address.identification_typeTipo de documento de identidade. Os documentos disponíveis são: CC,CE, TI, PP, NIT, RCeDE.CC
billing_address.identificationNúmero de identificação do usuário.1234567890
billing_address.first_namePrimeiro nome do usuário.João
billing_address.last_nameSobrenome do usuário.Pérez
billing_address.phoneNúmero de telefone em E.164format.+14155552671
billing_address.cityCidade para cobrança do usuário.Bogotá
billing_address.street1Informações de endereço principal para cobrança do usuário.Avenida Carrera 72 80
billing_address.street2Informações de apartamentos e suítes para cobrança do usuário.94
json
{
	"order_type": "DEUNA_CHECKOUT",
	"payer_info": {
		"email": "jrodriguez@gmail.com",
		"person_type": "NATURAL_PERSON" // Obtained from PSE form filled by the user
	},
	"callback_urls": {
		"on_success": "https://example.com/" // Redirection after completing PSE transaction
	},
	"payment_source": {
		"method_type": "bank_transfer",
		"processor": "payu_pse",
		"method_type_specific_fields": {
			"pse": {
				"financial_institution": "1022", // Code of selected bank, obtained from PSE form
				"financial_institution_name": "BANCO UNION COLOMBIANO" // Name of bank, obtained from PSE form
			}
		}
	},
	"order": {
		"order_id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
		"store_code": "all",
		"currency": "COP",
		"total_tax_amount": 200000,
		"items_total_amount": 1900000,
		"sub_total": 1900000,
		"total_amount": 2100000,
		"items": [
			{
				"id": "79",
				"name": "10 ALITAS VOLANTE",
				"description": "10 alitas picantes",
				"options": "string option",
				"total_amount": {
					"amount": 1900000,
					"currency": "COP",
					"currency_symbol": "$"
				},
				"unit_price": {
					"amount": 850000,
					"currency": "COP",
					"currency_symbol": "$"
				},
				"tax_amount": {
					"amount": 100000,
					"currency": "COP",
					"currency_symbol": "$"
				},
				"quantity": 2,
				"uom": "string",
				"upc": "string",
				"sku": "SKU-11021",
				"isbn": "12-345-678-90123",
				"brand": "Bolt Swagstore",
				"manufacturer": "Bolt Factory",
				"category": "hats",
				"color": "Red",
				"size": "XXL",
				"weight": {
					"weight": 22,
					"unit": "kg"
				},
				"image_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"details_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"type": "physical",
				"taxable": true
			}
		],
		"billing_address": {
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"email": "jrodriguez@gmail.com",
			"identification": "1234567890", // Document number obtained from PSE form
			"identification_type": "CC", // Document type obtained from PSE form
			"phone": "+578315263363",
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"zipcode": "110110",
			"city": "Bogota",
			"state_name": "Bogota",
			"country": "CO"
		},
		"shipping_address": {
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"email": "jrodriguez@gmail.com",
			"identification": "14201225",
			"identification_type": "CC",
			"phone": "+578315263363",
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"zipcode": "110110",
			"city": "Bogota",
			"state_name": "Bogota",
			"country": "CO"
		},
		"browser_details": {
			"ip_address": "155.95.122.206"
		}
	}
}

3. Redirecione o usuário

Após realizar a compra, a API responde com uma URL de redirecionamento no authorization_bank_transfer node.

  1. Pegue o URL do authorization_bank_transfer node.
  2. Redirecione o usuário para o URL.
  3. Aguarde o usuário concluir o pagamento.

    O usuário conclui o pagamento no PSE

  4. Ouça os webhooks PayU para confirmar o pagamento.

Resposta

JSON
{
	"order_type": "DEUNA_CHECKOUT",
	"order_token": "db3fc147-2a4e-460f-a874-f6f79b1e651c",
	"order": {
		"order_id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
		"store_code": "all",
		"currency": "COP",
		"tax_amount": 0,
		"display_tax_amount": "",
		"shipping_amount": 0,
		"display_shipping_amount": "COP 0,00",
		"items_total_amount": 1900000,
		"display_items_total_amount": "COP 19.000,00",
		"sub_total": 1900000,
		"display_sub_total": "COP 19.000,00",
		"total_amount": 2100000,
		"display_total_amount": "COP 21.000,00",
		"items": [
			{
				"id": "79",
				"name": "10 ALITAS VOLANTE",
				"description": "10 alitas picantes",
				"options": "string option",
				"total_amount": {
					"amount": 1900000,
					"original_amount": 0,
					"display_amount": "COP 19.000,00",
					"display_original_amount": "COP 0,00",
					"currency": "COP",
					"currency_symbol": "$",
					"total_discount": 0,
					"display_total_discount": "COP 0,00"
				},
				"unit_price": {
					"amount": 850000,
					"display_amount": "COP 8.500,00",
					"currency": "COP",
					"currency_symbol": "$"
				},
				"tax_amount": {
					"amount": 100000,
					"display_amount": "COP 1.000,00",
					"currency": "COP",
					"currency_symbol": "$"
				},
				"quantity": 2,
				"uom": "string",
				"upc": "string",
				"sku": "SKU-11021",
				"isbn": "12-345-678-90123",
				"brand": "Bolt Swagstore",
				"manufacturer": "Bolt Factory",
				"category": "hats",
				"color": "Red",
				"size": "XXL",
				"weight": {
					"weight": 22,
					"unit": "kg"
				},
				"image_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"details_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
				"type": "physical",
				"taxable": true,
				"discounts": [],
				"included_in_subscription": false,
				"subscription_id": "00000000-0000-0000-0000-000000000000",
				"item_details": []
			}
		],
		"discounts": [],
		"shipping_address": {
			"id": 0,
			"user_id": "",
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"phone": "+578315263363",
			"identity_document": "",
			"lat": 0,
			"lng": 0,
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"city": "Bogota",
			"zipcode": "110110",
			"state_name": "Bogota",
			"country_code": "CO",
			"additional_description": "",
			"address_type": "",
			"is_default": false,
			"created_at": "2025-01-20T16:49:38Z",
			"updated_at": "2025-01-20T16:49:38Z",
			"identity_document_type": "",
			"email": "jrodriguez@gmail.com",
			"state_code": "",
			"country": "CO"
		},
		"shipping_options": null,
		"user_instructions": "",
		"metadata": {},
		"status": "pending",
		"payment": {
			"data": {
				"amount": {
					"amount": 2100000,
					"currency": "COP"
				},
				"metadata": {
					"authorization_code": "",
					"reference_transaction_id": ""
				},
				"from_card": {
					"card_brand": "",
					"first_six": "",
					"last_four": "",
					"bank_name": "",
					"country_iso": "",
					"credential_source": ""
				},
				"updated_at": "2025-01-20 16:49:38.673262908 +0000 UTC",
				"method_type": "bank_transfer",
				"merchant": {
					"store_code": "all",
					"id": "2fe8d31e-f434-4628-869e-e894c13de929"
				},
				"created_at": "2025-01-20 16:49:38.67239479 +0000 UTC",
				"id": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
				"processor": "payu_pse",
				"customer": {
					"email": "Benny.Reynolds55@yahoo.com",
					"id": "56c3241c-5a7d-4f1b-99b6-b78cb78286a4",
					"first_name": "",
					"last_name": ""
				},
				"status": "pending",
				"reason": "",
				"external_transaction_id": "29e58cbf-051c-487a-8e3b-c37cb22be349",
				"authorization_bank_transfer": {
					"qr": "",
					"token": "",
					"expiration_date": "",
					"redirect_url": "",
					"reference": "4537041",
					"description": "Bank transfer transaction",
					"bank_name": "BANCO UNION COLOMBIANO",
					"external_transaction_status": "PENDING"
				},
				"merchant_payment_processor_name": "",
				"authorization_code": "",
				"installment_interest_calculations": null,
				"next_action": {
					"action": "authorization_bank_transfer",
					"authorization_bank_transfer": {
						"qr": "",
						"token": "",
						"expiration_date": "",
						"redirect_url": "https://sandbox.api.payulatam.com/payments-api/pse-caller?enc=aHR0cHM6Ly9yZWdpc3Ryby5kZXNhcnJvbGxvLnBzZS5jb20uY28vUFNFVXNlclJlZ2lzdGVyL1N0YXJ0VHJhbnNhY3Rpb24uYXNweD9lbmM9dG5QY0pITUtsU25tUnBITThmQWJ1em5HaEgySlNDcjQ5V1Y4YUttOGQ0eUJ4d0RvSmlrRGEwNFBjZE9Ca0JxSiMjanJvZHJpZ3VlekBnbWFpbC5jb20jIyMj",
						"reference": "",
						"description": "",
						"bank_name": "",
						"external_transaction_status": ""
					},
					"url": ""
				}
			}
		},
		"gift_card": [],
		"redirect_url": "",
		"webhook_urls": null,
		"total_discount": 0,
		"display_total_discount": "COP 0,00",
		"shipping": null,
		"cash_change": 0,
		"shipping_method": null,
		"shipping_methods": [],
		"timezone": "",
		"scheduled_at": "",
		"billing_address": {
			"id": 0,
			"user_id": "",
			"first_name": "Juan",
			"last_name": "Rodríguez",
			"phone": "+578315263363",
			"identity_document": "",
			"lat": 0,
			"lng": 0,
			"address1": "Avenida Carrera 72 80",
			"address2": "94",
			"city": "Bogota",
			"zipcode": "110110",
			"state_name": "Bogota",
			"country_code": "CO",
			"additional_description": "",
			"address_type": "",
			"is_default": false,
			"created_at": "2025-01-20T16:49:38Z",
			"updated_at": "2025-01-20T16:49:38Z",
			"email": "jrodriguez@gmail.com",
			"identity_document_type": "",
			"external_number": "",
			"internal_number": "",
			"country": ""
		},
		"payment_link": "",
		"display_shipping_tax_amount": "COP 0,00",
		"display_total_tax_amount": "COP 2.000,00",
		"shipping_tax_amount": 0,
		"total_tax_amount": 200000,
		"user_id": "",
		"include_payment_options": [],
		"redirect_urls": {
			"success": "",
			"pending": "",
			"error": "",
			"fallback": "",
			"close": ""
		},
		"created_at": "",
		"updated_at": "",
		"payer_info": null,
		"discount_amount": 0,
		"shipping_discount_amount": 0,
		"device_fingerprint": "",
		"expired_at": "",
		"version": "0",
		"fraud": null,
		"display_total_interest_amount": "",
		"payment_method": "",
		"token": "",
		"statement_descriptor": "",
		"browser_details": {
			"screen_height": 0,
			"screen_width": 0,
			"user_agent": "Mozilla/5.0 (Windows; U; Windows NT 6.3) AppleWebKit/532.0.1 (KHTML, like Gecko) Chrome/19.0.871.0 Safari/532.0.1",
			"ip_address": "41.3.66.146",
			"color_depth": 0,
			"java_enabled": false,
			"java_script_enabled": false,
			"language": "",
			"time_zone_offset": 0,
			"accept_header": ""
		}
	}
}