Astropay via Direct API

Integrate AstroPay as a payment method in your application via the DEUNA direct API.

Overview

AstroPay is a digital wallet that lets users pay, send, and receive money worldwide through multi-currency accounts. DEUNA integrates AstroPay as a wallet payment method.

The AstroPay checkout flow works as follows:

  1. User selects AstroPay as the payment method and enters their mobile number.
  2. The user is redirected to the AstroPay authorization page, which displays a QR code (and a "Copy link" option) for the order.
  3. The user opens the AstroPay app — either by scanning the QR code or via the copied link — and confirms the payment there.
  4. Payment is confirmed in real time once the user approves it in the app.

Requirements:

  • AstroPay via DEUNA is currently available for Argentina.
  • The user must have an active AstroPay account.
  • Environments:
    • Sandbox: https://api.sandbox.deuna.io
    • Production: https://api.deuna.io

Integrate AstroPay by API

Step 1: Create the order — POST /merchants/orders

Creates the order that the payment will be initiated against.

Request example

{
  "order": {
    "billingAddress": {
      "address1": "Jose Luis Lagrange 123, Piso 12",
      "address2": "Polanco I Sección",
      "addressType": "home",
      "city": "Buenos Aires",
      "countryCode": "ARG",
      "email": "[email protected]",
      "firstName": "Jean",
      "identityDocument": "205973330",
      "identityDocumentType": "CC",
      "lastName": "Doe",
      "lat": -23.555425,
      "lng": -46.677048,
      "phone": "+5491100000000",
      "stateName": "Buenos Aires",
      "zipcode": "7521"
    },
    "browserDetails": {
      "screenHeight": 1000,
      "screenWidth": 2000
    },
    "currency": "ARS",
    "items": [
      {
        "description": "Item description",
        "id": "daed042a-4002-4144-850f-0797dcdfe833",
        "imageUrl": "https://example.com/product.jpg",
        "name": "Item #1",
        "quantity": 2,
        "taxAmount": {
          "amount": 50,
          "currency": "ARS",
          "currencySymbol": "$"
        },
        "taxable": true,
        "totalAmount": {
          "amount": 2050,
          "currency": "ARS",
          "currencySymbol": "$",
          "originalAmount": 2100,
          "totalDiscount": 100
        },
        "unitPrice": {
          "amount": 1050,
          "currency": "ARS",
          "currencySymbol": "$"
        }
      }
    ],
    "orderId": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
    "paymentMethod": "wallet",
    "redirectUrls": {
      "success": "https://example.com/success"
    },
    "shippingAddress": {
      "additionalDescription": "confirm",
      "address1": "Rua Exemplo 123",
      "address2": "Bairro Exemplo",
      "addressType": "home",
      "city": "Buenos Aires",
      "countryCode": "BRA",
      "email": "[email protected]",
      "firstName": "Jean",
      "identityDocument": "205973330",
      "identityDocumentType": "CC",
      "lastName": "Doe",
      "lat": -22.943934,
      "lng": -43.182984,
      "phone": "+5491100000000",
      "stateName": "Buenos Aires",
      "zipcode": "1406"
    },
    "shippingMethods": [
      {
        "code": "12345JR",
        "cost": 250,
        "name": "Standard shipping"
      }
    ],
    "storeCode": "all",
    "subTotal": 5000000,
    "totalAmount": 5000000,
    "userInstructions": "Optional notes for the merchant",
    "webhookUrls": {
      "notifyOrder": "https://example.com/webhooks/order-status"
    }
  },
  "orderType": "DEUNA_CHECKOUT"
}

Step 2: Initiate the payment — POST /merchants/transactions/purchase

Using the order/token from Step 1, this call starts the AstroPay authorization.

Request example

{
  "token": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
  "methodType": "wallet",
  "processorName": "astropay",
  "orderType": "UNSPECIFIED",
  "email": "[email protected]",
  "payerInfo": {
    "email": "[email protected]",
    "personType": "UNKNOWN_PERSON"
  },
  "deviceId": "0cddd683-12ba-4fca-9a5f-9d98c24d7312",
  "sessionId": "aa23e46d-edf0-4b2c-aa5d-10dc80070bf8",
  "browserDetails": {
    "acceptHeader": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
    "colorDepth": 24,
    "language": "es",
    "screenHeight": 1440,
    "screenWidth": 2560
  },
  "billingAddress": {
    "address1": "Jose Luis Lagrange 123, Piso 12",
    "address2": "Polanco I Sección",
    "addressType": "home",
    "city": "Buenos Aires",
    "countryCode": "ARG",
    "email": "[email protected]",
    "firstName": "Jean",
    "identityDocument": "205973330",
    "identityDocumentType": "CC",
    "lastName": "Doe",
    "lat": -23.555425,
    "lng": -46.677048,
    "phone": "+5491100000000",
    "stateName": "Buenos Aires",
    "zipcode": "7521"
  },
  "specificFields": {
    "callbacks": {
      "onSuccess": "https://pay.deuna.io/redirect-to-commerce?orderToken=d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
      "onPending": "https://pay.deuna.io/redirect-to-commerce?orderToken=d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
      "onFailed": "https://pay.deuna.io/redirect-to-commerce?orderToken=d81fe7bf-748b-4a7a-bc8f-7be98c8ae748"
    }
  }
}

Response

{
  "order": {
    "orderId": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
    "transactionId": "d81fe7bf-748b-4a7a-bc8f-7be98c8ae748",
    "status": "pending",
    "currency": "ARS",
    "totalAmount": 5000000,
    "payment": {
      "data": {
        "methodType": "wallet",
        "processor": "astropay",
        "status": "pending",
        "externalTransactionId": "92nAZK3PJQ4lrY3ln43CmV6Tbr8YqKXw5ykCpYwE",
        "nextAction": {
          "action": "authorization_wallet",
          "authorizationWallet": {
            "redirectUrl": "https://checkout-sandbox.astropay.com/payment/92nAZK3PJQ4lrY3ln43CmV6Tbr8YqKXw5ykCpYwE?data=..."
          }
        }
      }
    }
  }
}

3. Redirect the user

  1. Take the URL from payment.data.nextAction.authorizationWallet.redirectUrl.
  2. Redirect the user to that URL. AstroPay displays a page with a QR code and a "Copy link" option for the order — the user scans the code (or opens the copied link) with the AstroPay app and confirms the payment there.
  3. Once the user approves the payment in the app, AstroPay redirects the user back through DEUNA's callback URLs.
  4. Right after Step 2, the status sit at pending — the user still needs to confirm the payment in the AstroPay app. Once they approve it, the status becomes succeeded or denied.
  5. Listen to the webhook configured in order.webhookUrls.notifyOrder (Step 1) to confirm the final payment status.



Did this page help you?