Create an e-Wallet Transaction

This guide outlines the general steps to create an e-wallet transaction using the PagSeguro Internation Payin API. You'll learn how to collect payer details, initiate a payment, and redirect the customer to complete the transaction.

๐Ÿ“˜

Supported e-Wallets

PagSeguro International Payin API currently supports PagBank, PayPal, PagSeguro, and Google Pay.

The flow described here applies to PagBank, PayPal, and PagSeguro e-Wallets.

e-Wallet Payment Flow

  1. Customer โ†’ Merchant: The customer fills in and submits all required payment information on the merchantโ€™s website.
  2. Merchant โ†’ PagSeguro: The merchant sends a request to the Create transaction endpoint.
  3. PagSeguro โ†’ Merchant: PagSeguro creates the order and responds with a transaction code and a payment URL.
  4. Merchant โ†’ Customer: The merchant redirects the customer to the payment URL.
  5. Customer โ†’ Payment Provider: The customer completes the payment through the selected payment method's website.
  6. Payment Provider โ†’ Customer: After completing or canceling the payment:
    • On success, the customer is redirected to the merchant's success URL.
    • On failure or cancellation, the customer is redirected to the merchant's fail URL.

Follow the steps below to create an e-wallet payment:

Step 1: Collecting Payer Details

The customer must provide all mandatory information, such as name, email, document type and number, and address.

๐Ÿšง

Delivery Address

Payer address is required when the cart item type is physical.

Step 2: Create a Transaction with PayPal

After the customer sends their information, use the Create transaction endpoint to submit it to PagSeguro. Below are examples of requests and responses to create the transaction using PayPal e-Wallet.

{
  "integration": {
    "reference": "REF-XXX-1234567890",
    "notification_url": "https://www.merchantwebsite.com/notify?type=transaction",
    "language": "en_US",
    "redirect_url": {
      "success": "https://www.merchantwebsite.com/successFlow",
      "failure": "https://www.merchantwebsite.com/returnFlow"
    }
  },
  "order": {
    "currency": "USD",
    "items": [
      {
        "quantity": 1,
        "description": "Product description",
        "unit_price": 101.10
      }
    ]
  },
  "charge": {
    "country": "US",
    "method": "PAYPAL"
  },
  "payer": {
    "email": "[email protected]"
  }
}

{
  "code": "25a58ef1-3755-476b-b2f6-e445b170a849",
  "reference": "REF-XXX-1733152707223",
  "status": "PENDING",
  "amount": 101.1,
  "currency": "USD",
  "country": "US",
  "created_at": "2021-04-12T12:43:13Z",
  "payment_instructions": {
    "interaction_type": [
      "REDIRECT"
    ],
    "redirect": {
      "url": "https://checkout.international.pagseguro.com/"
    }
  }
}

If you want to use a different method, you need to change the charge.country and charge.metod information.

๐Ÿ“˜

Reason Codes

If the request fails, the API will return an HTTP status code other than 200. The response body will include an errors array with descriptive messages and corresponding error codes.

For the full list of possible error codes, see the Reason Codes reference.

Available Payment Methods

For charge.metod, you have the following options available:

Payment MethodRefundsRecurringChargebackschargemethod
PagBankYesNoNoe-walletPAGBANK
PayPalYesNoYese-walletPAYPAL
PagSeguroYesNoYese-walletPAGSEGURO

Step 3: Redirecting Customer to e-Wallet Page

With the response from the Create transaction endpoint, you can redirect your customer to the URL returned in the payment_instructions.redirect.url.