Página Checkout (E-com)

Cómo usar la página de pago de Pagsmile para enviar un payin en Brasil.

Payin al usar la página Pagsmile checkout

POST https://gateway-test.pagsmile.com/trade/create

Este endpoint le permite enviar un pago mediante la página de pago de Pagsmile

Headers

NameTypeDescription

Content-Type*

string

applicacion/json; chartset=UTF-8

Authorization*

string

Basic Base($app_id:$security_key)

Request Body

NameTypeDescription

app_id*

string

Id de app creado en dashboard

- Max. 32 chars -

customer.identify.number*

string

Número de id de usuario

method

string

Si vacío, se mostrarán todos los métodos habilitados.

si no está vacío, solo el método seleccionado se mostrará. Ver here todos los métodos.

out_trade_no*

string

ID dado por el merchant en su sistema - Max. 64 chars -

notify_url*

string

Donde Pagsmile enviará la notificación

customer.identify.type*

string

Tipo de identificación de usuario

- ver here para verificar id´s por país -

timestamp*

string

yyyy-MM-dd HH:mm:ss - Max. 19 chars -

subject*

string

Razón de pago o título

- Max. 128 chars -

order_amount*

string

Monto de orden - 0.01 ~ 999999999 -

(referir a monto límite por methods)

order_currency*

string

Moneda de orden - Max. 3 chars -

content*

string

Detalle de razón de pago o título. Se mostrará en el recibo del banco.

- Max. 255 chars -

buyer_id*

string

Usuario id de merchant

address.postal_code*

string

zip code

address.street*

string

carretera

address.street_number*

string

Número de calle

address.city*

string

ciudad

address.state*

string

estado

channel

string

Sólo método = Wallet

customer.phone*

string

Telefóno de usuario

customer.email*

string

Correo de usuario

customer.name*

string

Nombre de usuario

address.country*

string

país

trade_type*

string

Valor fijo: WEB

billing.address.postal_code*

string

zip code de facturación

billing.address.country*

string

País de facturación

billing.address.state*

string

Estado de facturación

billing.address.city*

string

Ciudad de facturación

billing.address.street*

string

Calle de facturación

billing.address.street_number*

string

Número de calle de facturación

billing.address.neighborhood*

string

Vecindario de facturación

billing.identification.number*

string

Identificación de facturación

billing.identification.type*

string

Tipo de id de facturación

address.neighborhood*

string

Vecindario

billing.phone*

string

Teléfono de facturación

billing.email*

string

Correo de facturación

billing.name*

string

Nombre de facturación

shipping.address.street_number*

string

Número de calle de envío

shipping.idenification.type*

string

Tipo de ID de envío

shipping.identification.number*

string

ID para envío

shipping.address.neiborhood*

string

Vecindario de envío

shipping.address.street*

string

Calle de envío

shipping.address.city*

string

Ciudad de envío

shipping.address.state*

string

Estado de envío

shipping.address.country*

string

País de envío

shipping.address.postal_code*

string

zip code de envío

shipping.phone*

string

Teléfono de envío

shipping.email*

string

Correo de envío

shipping.name*

string

Nombre de envío

products.quanity*

string

Cantidad de producto

products.name*

string

Nombre de producto - Max. 200 chars -

products.url*

string

url de producto - Max. 2000 chars -

products.description*

string

Descripción de producto - Max. 1000 chars -

return_url

sring

web URL de redirección al finalizar pago

timeout_express

string

m(minutos), h(horas), d(días), c(siempre acaba en día actual).

Usado para controlar tiempo de expiración de enviar una orden (desde initial a processing). (90m defecto, max 15d)

version*

string

Valor fijo: 2.0

cancellation_express

string

m(minutos), h(horas), d(días). Valor debe ser integer.

Usado para cancelar orden. Ex: 90m Usado para controlar tiempo de expiración de processing orden.

{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354003",
    "web_url": "http://checkout.pagsmile.com?prepay_id=123456"
}

Ejemplo

curl --location --request POST 'https://gateway-test.pagsmile.com/trade/create' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "charset": "UTF-8",
    "app_id": "162************38",
    "out_trade_no": "202201010354002",
    "order_currency": "BRL",
    "order_amount": "12.01",
    "subject": "item name",
    "content": "20 item description",
    "trade_type": "WEB",
    "timeout_express": "15d",
    "timestamp": "2022-01-01 03:54:01",
    "notify_url": "http://merchant/callback/success",
    "buyer_id": "buyer_0101_0001",
    "version": "2.0",
    "customer" : {
        "identification": {
            "type": "CPF",
            "number": "50284414001"
        },
        "name": "customer user name",
        "email": "test@gmail.com",
        "phone": "5511987654321",
    	"buyer_id": "buyer_0101_0001",
        "ip": "127.0.0.1"
    },
    "address":{
   	       "postal_code":"38082365",
               "country":"address test country",
               "state":"address state123",
               "city":"address city123",
               "street":"address streetqqq",
               "street_number":"4567",
               "neighborhood":"neighbor address222"
   			 },
    "billing": {
        "address": {
               "postal_code":"38082365",
               "country":"billingtest country001",
               "state":"billingstate123",
               "city":"billingcity123",
               "street":"billingstreetqqq",
               "street_number":"22222",
               "neighborhood":"billingneighborhood222"
        },
        "identification": {
            "type": "cpf",
            "number": "50284414727"
        },
        "email": "email@test.com",
        "name": "test",
        "phone": "5511987654321"
    },
    "shipping": {
        "address": {
               "postal_code":"38082365",
               "country":"Brazil",
               "state":"shipping state123",
               "city":"shipping city123",
               "street":"shipping streetqqq",
               "street_number":"4567",
               "neighborhood":"shipping hood222"
        },
        "identification": {
            "type": "cpf",
            "number": "50284414727"
        },
        "email": "email@test.com",
        "name": "test",
        "phone": "5511987654321"
    },
    "products": [
        {
            "quantity": "1",
            "name": "product 1",
            "url": "https://www.pagsmile.com/product/1",
            "description": "this is a product"
        },
        {
            "quantity": "1",
            "name": "product 2",
            "url": "https://www.pagsmile.com/product/2",
            "description": "this is a product"
        },
        {
            "quantity": "3",
            "name": "product 3",
            "url": "https://www.pagsmile.com/product/3",
            "description": "this is a product"
        },
        {
            "quantity": "4",
            "name": "product 4",
            "url": "https://www.pagsmile.com/product/4",
            "description": "this is a product"
        }
    ]
}'

La dirección URL de retorno no es necesaria en los parámetros de solicitud. Sin embargo, si necesario, puede sobrescribirlo agregando el return_url después de la web_url cuando se redirige.

http://checkout.pagsmile.com?prepay_id={$prepay_id}

↓↓↓

http://checkout.pagsmile.com?prepay_id={$prepay_id}&return_url=encodeURIComponent({$return_url})

Nota: 162************38 es el test ID de pagsmile para prueba en sandbox, y MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ== es el token de autorización asociado con el app ID de prueba.

Favor utilizar tu propio app_id y genera tu propio authorization token al realizar pruebas.

Last updated