Guaranteed ACH

Guaranteed ACH payment methods help reduce the risk of insufficient funds (NSF) and consumer returns for gaming operators that accept ACH transfers. A typical, non-guaranteed ACH takes 1-2 banking days to process. By the time those funds are pulled from the player’s account, he or she may not have sufficient funds to cover the amount that has most likely already been wagered, resulting in significant funding losses for the operator. To help mitigate the risk of ACH transfers, PayNearMe has partnered with Trustly, a leading provider of bank account authorizations and intuitive online banking integrations to underwrite and guarantee funds for our gaming operators. The following guide provides an overview of Trustly’s guaranteed ACH solution and how operators can quickly integrate to it using PayNearMe’s existing APIs and the PayNearMe for iGaming platform.

📘

Knowledge Check

The integration steps outlined in this guide should be undertaken by operators who are already familiar with the Embedded Client and the PayNearMe for iGaming platform. For more information on PayNearMe for iGaming, see the PayNearMe for iGaming Integration Guide.

Player Experience

For players, the Embedded Client flow for a guaranteed ACH payment method remains largely unchanged. Trustly uses a Lightbox Widget that displays within PayNearMe’s Embedded Client iframe to collect and authenticate bank account information before seamlessly transitioning back to the “Complete Your Payment Details” screen. Players can manually add their account details or log into their online bank account and select a checking or savings account from which to make the deposit.

To make a guaranteed ACH deposit, players would perform the following steps from the operator’s cashier page:

  1. The player clicks the deposit button, link, or clickable HTML tag that invokes the PayNearMe JS library. The “Choose a Payment Method” screen displays.

  2. The player clicks the Online Banking payment method. The Trustly Lighbox Widget displays where the player can search for his/her bank, scroll through the list of banks displayed, or manually enter his/her bank account information.

  3. After the player selects his/her bank, the Embedded Client displays the bank’s online banking login page. The player enters his/her online banking credentials and selects Agree and Sign In.

  4. Once the player has successfully signed in, he/she selects the checking or savings account from which he/she would like to make the deposit and then selects whether the account is Personal or Business. To read the PayNearMe payment authorization agreement, the player can click the PayNearMe Transaction Authorization dropdown box. Once he/she has selected the appropriate account and account type, he/she can click Continue.

  5. The Trustly Lightbox Widget redirects the player back to the Embedded Client’s “Complete Your Payment Details” screen. If editable, the player enters the amount of his/her deposit and then clicks Submit Payment.

  6. The Embedded Client processes the player’s payment and then redirects him/her back to the operator’s site.

Embedded Client Trustly Flow

The following data flow diagram displays the typical flow for a guaranteed ACH deposit via the PayNearMe Embedded Client.

Required Additional Parameters for Guaranteed ACH Payments

To facilitate a guaranteed ACH payment for a player, an operator must send the following additional parameters in their /get_smart_token calls to PayNearMe:

ParameterTypeRequired?Description
flow_trustlyboolRIndicates whether to include a guaranteed ACH payment method via Trustly.
ext_customer_enrollment_datestringRRecords the date of the player’s first transaction with the operator in YYYY-MM-DD format.
ext_customer_date_of_birth_piistringRRecords the player’s birth date in YYYY-MM-DD format. NOTE: Parameters suffixed with _pii contain personal identifying information (PII). PayNearMe encrypts parameter values containing PII before storing and only returns specific and/or redacted information in the response.
ext_customer_tax_id_piistringRRecords the player’s Social Security Number or other Tax ID. NOTE: Parameters suffixed with _pii contain personal identifying information (PII). PayNearMe encrypts parameter values containing PII before storing and only returns specific and/or redacted information in the response.
flow_bank_oauth_redirect_urlstringRIndicates the URL where players should be redirected to when logging into native bank applications that use OAuth login authorization flows. Rather than having to remember and type in a password in a new browser window, OAuth logins enable players to log in via the banking app on their phone using saved passwords or biometric authentication (like FaceID or fingerprints). For the Embedded Client, this link should redirect players back to the “Complete Your Payment Details” screen.
flow_trustly_reconnectstringOIdentifies the payment method the Operator wants to reauthorize for a guaranteed ACH payment. This parameter should only be included when a bank revokes a previously authorized payment method. See the Handling an Expired Bank Authorization section for more information.

Creating Orders

All PayNearMe transactions require orders. In the gaming space, orders are simply a record of a player’s deposits and withdrawals. Orders can be created through a comma or pipe-delimited .csv file that is uploaded daily via SFTP transmission or through the /create_order API call.

The following code samples display a new order for a player.

curl --request POST \
     --url https://api.paynearme-sandbox.com/json-api/create_order \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "site_identifier": "S6404173951 ",
  "timestamp": "1721941353",
  "version": "3.0",
  "signature": "f9ec2929b539ca8f8affb75218ef75c2d68c06976bfa941463e47f8eb2090a0e",
  "order_amount": 500,
  "order_currency": "USD",
  "site_customer_identifier": "575530001",
  "order_type": "any",
  "order_is_standing": true,
  "site_order_identifier": "6969675879",
  "site_customer_phone": "212-555-1212",
  "site_customer_email": "[email protected]",
  "site_customer_language": "en",
  "site_customer_year_of_birth": "1950",
  "site_customer_first_name": "Peter",
  "site_customer_last_name": "Venkman",
  "site_customer_street": "236+W+34th+Street",
  "site_customer_city": "New York",
  "site_customer_state": "NY",
  "site_customer_postal_code": "10001"
}
'
{
  "status": "ok",
  "order": {
    "site_name": "Nanzer-IVR",
    "site_logo_url": "https://www.paynearme-sandbox.com",
    "site_order_identifier": "6969675870",
    "type": "order",
    "site_identifier": "S6404173951",
    "require_auth_tracker": "false",
    "pnm_order_crid": "i1pWxy",
    "pnm_customer_language": "en",
    "pnm_order_identifier": "82882345534",
    "pnm_order_short_identifier": "LT95NN",
    "site_order_key": "575530001",
    "order_created": "2024-07-25 14:02:34 -0700",
    "order_status": "open",
    "order_amount": "500.00",
    "order_currency": "USD",
    "minimum_payment_amount": "0.00",
    "minimum_payment_currency": "USD",
    "order_type": "any",
    "order_is_standing": "true",
    "secure_smart_token": "TeNoFU!9CSdj3OvZBxC7xpMgHBmBQR8!ZPjO2cHjRytHC1tcr8lVBSQ891pBq4!n",
    "secure_smart_link": "https://www.paynearme-sandbox.com/ssl/TeNoFU!9CSdj3OvZBxC7xpMgHBmBQR8!ZPjO2cHjRytHC1tcr8lVBSQ891pBq4!n",
    "order_tracking_url": "https://www.paynearme-sandbox.com/82882345534",
    "electronic_payments": {
      "payment_methods": [
        {
          "type": "ach",
          "fee_amount": "0.00",
          "fee_currency": "USD",
          "accounts": [

          ]
        },
        {
          "type": "apple_pay_credit",
          "fee_amount": "0.00",
          "fee_currency": "USD",
          "accounts": [

          ]
        },
        {
          "type": "paypal",
          "fee_amount": "10.00",
          "fee_currency": "USD",
          "accounts": [

          ]
        },
        {
          "type": "debit",
          "fee_amount": "0.00",
          "fee_currency": "USD",
          "accounts": [

          ]
        },
        {
          "type": "credit",
          "fee_amount": "0.00",
          "fee_currency": "USD",
          "accounts": [

          ]
        },
        {
          "type": "gpay",
          "fee_amount": "0.00",
          "fee_currency": "USD",
          "accounts": [

          ]
        },
        {
          "type": "apple_pay_debit",
          "fee_amount": "0.00",
          "fee_currency": "USD",
          "accounts": [

          ]
        }
      ]
    },
    "cards": null,
    "customer": {
      "pnm_customer_identifier": "U4557822272",
      "site_customer_identifier": "575530001",
      "pnm_customer_name": "Peter Venkman",
      "pnm_customer_email": "[email protected]",
      "pnm_customer_phone": "2125551212",
      "pnm_customer_addressee": "Peter Venkman",
      "pnm_customer_street": "236 W 34th Street",
      "pnm_customer_city": "New York",
      "pnm_customer_state": "NY",
      "pnm_customer_postal_code": "10001",
      "pnm_customer_language": "en"
    }
  }
}

Regenerating the Smart Token

Most operators that use the Embedded Client create orders from their own player records and then simply regenerate the Smart Token when the player is ready to make a deposit or withdrawal. For guaranteed ACH payments, operators must include the following parameters to ensure Trustly can authenticate the account:

  • ext_customer_date_of_birth_pii
  • ext_customer_enrollment_date
  • ext_customer_tax_id_pii
  • flow_bank_oauth_redirect_url
  • flow_trustly=true
curl --request POST \
     --url https://api.paynearme-sandbox.com/json-api/get_smart_token \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "ext_customer_date_of_birth_pii":"1982-12-21",
  "ext_customer_enrollment_date":"2024-07-25",
  "ext_customer_tax_id_pii":"123456677",
  "flow_bank_oauth_redirect_url":"freehold-gaming://freehold.us/cashier/deposit/status/82882345534",
  "flow_no_pay_url":"freehold-gaming://portal.freehold.us/cashier/deposit/ach",
  "flow_pay_url":" freehold-gaming://portal.freehold.us/cashier/deposit/status/82882345534",
  "flow_return_url":"freehold-gaming://portal.freehold.us/cashier",
  "flow_trustly":"true",
  "pnm_order_identifier":"82882345534",
  "site_identifier": "S6404173951",
  "timestamp": "1721943463",
  "version": "3.0",
  "signature": "68bdeeeeb14b09dfee92ccab3ec5fdfb7139c09ec22470867894ac71e51d65b5"
}
'
{
  "status": "ok",
  "orders": [
    {
      "pnm_order_identifier": "82882345534",
      "site_order_identifier": "6969675870",
      "type": "order",
      "secure_smart_token": "TeNoFU!9CSdj3OvZBxC7xq78qmVv0QMzKuS18QHxpAtttew6q5qXzkeRv$209APPPp18nfWLH12MAus4Zwb6Vbm1w$czmROW8LOyx6Q$PoN99o0$KkRtx9Wnv2nigckXLvf3nF1u7AP$!0lIRBgY9!YzYeS6!TuIU2u$8mueuFmnzMhmZndb0NGpxOaeQBMn5qzqX!9EWyXrHC8rQsGgeiQyV6M7SQkU2qyMdXABR$IjCbJn$38kPOCedMD$iuhW3GY8RISnvkCt3L8ETDH8Xc9HfsK2lGcTSG0B3$7qlSrcQiT3sBdNr$scLytCwaB6JDJXoztJCRTarIx1cAFH4iMJsmf7fyQ84J50wP6K6FbcZjxEhKe$QK3cvwRMMfxd1mPd7hHEWHjCa2oYPYiHXMpdaENeH4jXt0ueJxhQpC1NTnn8bwzhs9LS!DhxR$OHLX9zv71wKQuFOaKbeGhUTcT6WQ9yIJOBk!2qOFpfZEjXISRed0F8HfBBsz!p8rmU87NQtlZPYYJLi2MzXc1XRdIc9CJNIGOYzgcWT$xGzf1932U!Z!A!OLvKpWpMBobrNBXJNmPVJYOX5mkeeJtFVUcA5e7hbKvPvhZjpXVNni83IyXTAc0AVL5PyFbX3$5rHvuP2J1kgJEXIF16wcrWoZfmaR54m0VVQewcwlhXHdNPY$133p7!gqSIV07dhEZh65NNsL5!!p7JY4Dt5lCVBH5MzI27s2!wFLhhvedKZFk0p40RMyfpprXDBjJtMoHb!JAA1plgGnFK!7kUGm3Kofc0DJGQaNLEpzzFbUANDrs=",
      "secure_smart_link": "https://www.paynearme-sandbox.com/ssl/TeNoFU!9CSdj3OvZBxC7xq78qmVv0QMzKuS18QHxpAtttew6q5qXzkeRv$209APPPp18nfWLH12MAus4Zwb6Vbm1w$czmROW8LOyx6Q$PoN99o0$KkRtx9Wnv2nigckXLvf3nF1u7AP$!0lIRBgY9!YzYeS6!TuIU2u$8mueuFmnzMhmZndb0NGpxOaeQBMn5qzqX!9EWyXrHC8rQsGgeiQyV6M7SQkU2qyMdXABR$IjCbJn$38kPOCedMD$iuhW3GY8RISnvkCt3L8ETDH8Xc9HfsK2lGcTSG0B3$7qlSrcQiT3sBdNr$scLytCwaB6JDJXoztJCRTarIx1cAFH4iMJsmf7fyQ84J50wP6K6FbcZjxEhKe$QK3cvwRMMfxd1mPd7hHEWHjCa2oYPYiHXMpdaENeH4jXt0ueJxhQpC1NTnn8bwzhs9LS!DhxR$OHLX9zv71wKQuFOaKbeGhUTcT6WQ9yIJOBk!2qOFpfZEjXISRed0F8HfBBsz!p8rmU87NQtlZPYYJLi2MzXc1XRdIc9CJNIGOYzgcWT$xGzf1932U!Z!A!OLvKpWpMBobrNBXJNmPVJYOX5mkeeJtFVUcA5e7hbKvPvhZjpXVNni83IyXTAc0AVL5PyFbX3$5rHvuP2J1kgJEXIF16wcrWoZfmaR54m0VVQewcwlhXHdNPY$133p7!gqSIV07dhEZh65NNsL5!!p7JY4Dt5lCVBH5MzI27s2!wFLhhvedKZFk0p40RMyfpprXDBjJtMoHb!JAA1plgGnFK!7kUGm3Kofc0DJGQaNLEpzzFbUANDrs=",
      "order_tracking_url": "https://www.paynearme-sandbox.com/82882345534/tr?pay_url=freehold-gaming%3A%2F%2Fportal.freehold.us%2Fcashier%2Fdeposit%2Fstatus%2F82882345534&no_pay_url=freehold-gaming%3A%2F%2Fportal.freehold.us%2Fcashier%2Fdeposit%2Fach&return_url=freehold-gaming%3A%2F%2Fportal.freehold.us%2Fcashier&bank_oauth_redirect_url=freehold-gaming%3A%2F%2Fportal.freehold.us%2Fcashier%2Fdeposit%2Fstatus%2F82882345534"
    }
  ]
}

After receiving the response from the /get_smart_token call, the operator opens the secure_smart_link URL in their application browser so the player can begin the bank login process.

Sample Data Flows

The following sections detail common data flows and scenarios that can occur with guaranteed ACH payments.

First Guaranteed ACH Payment by Player

  1. The Operator calls the /get_smart_token with the additional required guaranteed ACH parameters.
    curl --request POST \
         --url https://api.paynearme-sandbox.com/json-api/get_smart_token \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
      "ext_customer_date_of_birth_pii":"1982-12-21",
      "ext_customer_enrollment_date":"2024-07-25",
      "ext_customer_tax_id_pii":"123456677",
      "flow_bank_oauth_redirect_url":"freehold-gaming://freehold.us/cashier/deposit/status/82882345534",
      "flow_no_pay_url":"freehold-gaming://portal.freehold.us/cashier/deposit/ach",
      "flow_pay_url":" freehold-gaming://portal.freehold.us/cashier/deposit/status/82882345534",
      "flow_return_url":"freehold-gaming://portal.freehold.us/cashier",
      "flow_trustly":"true",
      "pnm_order_identifier":"82882345534",
      "site_identifier": "S6404173951",
      "timestamp": "1721943463",
      "version": "3.0",
      "signature": "68bdeeeeb14b09dfee92ccab3ec5fdfb7139c09ec22470867894ac71e51d65b5"
    }
    '
    
  2. The Operator opens the secure_smart_link URL in their application browser.
  3. The player completes the bank login flow within the PayNearMe Embedded Client flow.
  4. The player chooses the checking or savings account he/she wants to use for payment.
  5. The player completes the payment by selecting the Submit Payment button in the PayNearMe Embedded Client flow.
  6. If configured, PayNearMe sends an Authorization callback to the Operator.
    {
      "pnm_order_identifier": "82882345534",
      "pnm_payment_identifier": "579655614986",
      "site_customer_identifier": "184120000",
      "version": "3.0",
      "payment_amount": "1000.00",
      "payment_currency": "USD",
      "payment_date": "1721768786",
      "net_payment_amount": "1000.00",
      "net_payment_currency": "USD",
      "pnm_withheld_amount": "20.20",
      "pnm_withheld_currency": "USD",
      "due_to_site_amount": "979.80",
      "due_to_site_currency": "USD",
      "due_to_parent_amount": "0.00",
      "due_to_parent_currency": "USD",
      "due_to_child_amount": "979.80",
      "due_to_child_currency": "USD",
      "payment_type": "ach",
      "site_identifier": "S6404173951",
      "payment_bank_name": "Demo Checking Account",
      "payment_bank_last4": "6576",
      "timestamp": "1721768787"
    }
    
  7. If the transaction is authorized, the Operator responds to the callback with the order’s pnm_order_identifier.
  8. The Embedded Client redirects the player to the flow_pay_url provided in the /get_smart_token call. Typically, this URL is a page in the Operator’s application that displays a success message for the deposit.
  9. PayNearMe sends the Operator a Confirmation callback with the payment details.
{
  "pnm_order_identifier": "82882345534",
  "pnm_payment_identifier": "579655614986",
  "site_customer_identifier": "184120000",
  "version": "3.0",
  "net_payment_amount": "1000.00",
  "net_payment_currency": "USD",
  "payment_amount": "1000.00",
  "payment_currency": "USD",
  "timestamp": "1721768787",
  "status": "payment",
  "pnm_withheld_amount": "20.20",
  "pnm_withheld_currency": "USD",
  "due_to_site_amount": "979.80",
  "due_to_site_currency": "USD",
  "due_to_parent_amount": "0.00",
  "due_to_parent_currency": "USD",
  "due_to_child_amount": "979.80",
  "due_to_child_currency": "USD",
  "standin": "false",
  "payment_timestamp": "2024-07-25 19:04:32 -0700",
  "order_payee_identifier": "S2893783906",
  "payment_type": "ach",
  "site_identifier": "S6404173951",
  "payment_bank_name": "Demo Checking Account ",
  "payment_bank_last4": "6576"
}
  1. The Operator responds to the callback with the order’s pnm_order_identifier and updates the player’s balance(s) in their system.

Make a Guaranteed ACH Payment with Saved Bank Details

  1. The Operator calls the /find_payment_methods API endpoint to grab the payment methods the player has saved to his or her record.
    curl --request POST \
         --url https://api.paynearme-sandbox.com/json-api/find_payment_methods \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
      "site_identifier": "S6404173951",
      "timestamp": "1722287208",
      "version": "3.0",
      "signature": "d1d51191fa85b502882a3fbd4b8f9ea5e14010cc017c2e3b88821c1b51cf6353",
      "site_customer_identifier": "184120000"
    }
    '
    
  2. The Operator gets the active guaranteed ACH payment method details from the response and displays them to the player. Note that guaranteed ACH payment methods will be notated with a trustly_ach label in the account_type parameter.
    {
      "status": "ok",
      "accounts": [
        {
          "payment_method_identifier": "76590ef5135ae",
          "status": "active",
          "description": "Demo Savings Account",
          "account_type": "Personal trustly_ach",
          "pull_enabled": "true",
          "push_enabled": "false",
          "number": "6213",
          "fee_amount": "0.00"
        },
        {
          "payment_method_identifier": "23b9e4ba13242",
          "status": "active",
          "description": "Demo Checking Account",
          "account_type": "Personal trustly_ach",
          "pull_enabled": "true",
          "push_enabled": "false",
          "number": "6576",
          "fee_amount": "0.00"
        }
      ]
    }
    
  3. The Operator collects the payment method and amount from the player and calls the /make_payment API endpoint.
    curl --request POST \
         --url https://api.paynearme-sandbox.com/json-api/make_payment \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
      "site_identifier": "S6404173951",
      "timestamp": "1722289425",
      "version": "3.0",
      "signature": "c341226221bede672b3ad9e6376016c21df8adaf5f69a6266fea46c847291c81",
      "payment_method_identifier": "76590ef5135ae",
      "payment_amount": "1000",
      "payment_currency": "USD",
      "site_channel": "consumer",
      "pnm_order_identifier": "84274665124"
    }
    '
    
  4. If configured, PayNearMe sends the Authorization callback to the Operator.
    {
      "pnm_order_identifier": "84274665124",
      "pnm_payment_identifier": "943751749956",
      "site_order_identifier": "6969248991",
      "site_customer_identifier": "184120000",
      "version": "3.0",
      "test": true,
      "payment_amount": "1000.00",
      "payment_currency": "USD",
      "payment_date": "1722289426",
      "net_payment_amount": "1000.00",
      "net_payment_currency": "USD",
      "pnm_withheld_amount": "20.20",
      "pnm_withheld_currency": "USD",
      "due_to_site_amount": "979.80",
      "due_to_site_currency": "USD",
      "payment_type": "ach",
      "site_identifier": "S6404173951",
      "payment_bank_name": "Demo Savings Account",
      "payment_bank_last4": "6213",
      "timestamp": "1722289426",
      "signature": "6252aaef2fd78d83e17426e6e56fd80410c9dc3b3b312e1d5be1bba3bde5e5a4"
    }
    
  5. If the transaction is authorized, the Operator responds to the callback with the order’s pnm_order_identifier.
  6. The Operator displays a “Thank you for your deposit” message to the player.
  7. PayNearMe sends the Operator a Confirmation callback with the payment details.
    {
      "pnm_order_identifier": "84274665124",
      "pnm_payment_identifier": "943751749956",
      "site_customer_identifier": "184120000",
      "site_payment_identifier": "992761bd-e5eb-4a40-a53b-68de6e90dbf7",
      "version": "3.0",
      "net_payment_amount": "1000.00",
      "net_payment_currency": "USD",
      "payment_amount": "1000.00",
      "payment_currency": "USD",
      "timestamp": "1722289537",
      "status": "payment",
      "pnm_withheld_amount": "20.20",
      "pnm_withheld_currency": "USD",
      "due_to_site_amount": "979.80",
      "due_to_site_currency": "USD",
      "due_to_parent_amount": "0.00",
      "due_to_parent_currency": "USD",
      "due_to_child_amount": "979.80",
      "due_to_child_currency": "USD",
      "standin": "false",
      "payment_timestamp": "2024-07-29 09:32:23 -0700",
      "order_payee_identifier": "S6404173951",
      "payment_type": "ach",
      "site_identifier": "S6404173951",
      "payment_bank_name": "Demo Savings Account ",
      "payment_bank_last4": "6213",
    }
    
  8. The Operator responds to the callback with the order’s pnm_order_identifier and updates the player’s balance(s) in their system.

Handling an Expired Bank Authorization

Banks can revoke authorizations after a certain amount of time has passed or for their own internal risk reasons. PayNearMe does not know when authorizations are revoked until we receive an authorization expiration message when attempting to make a guaranteed ACH payment. However, bank accounts can be re-authorized by asking the player to re-enter his or her online banking credentials via the Trustly Lightbox Widget.

  1. The Operator calls the /find_payment_methods API endpoint to get the payment methods the player has saved to his or her record.

    curl --request POST \
         --url https://api.paynearme-sandbox.com/json-api/find_payment_methods \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
      "site_identifier": "S6404173951",
      "timestamp": "1722287208",
      "version": "3.0",
      "signature": "d1d51191fa85b502882a3fbd4b8f9ea5e14010cc017c2e3b88821c1b51cf6353",
      "site_customer_identifier": "184120000"
    }
    '
    
  2. The Operator gets the active guaranteed ACH payment method details from the response and displays them to the player. Note that guaranteed ACH payment methods will be notated with a trustly_ach label in the account_type parameter.

    {
      "status": "ok",
      "accounts": [
        {
          "payment_method_identifier": "23b9e4ba13242",
          "status": "active",
          "description": "Demo Checking Account",
          "account_type": "Personal trustly_ach",
          "pull_enabled": "true",
          "push_enabled": "false",
          "number": "6576",
          "fee_amount": "0.00"
        }
      ]
    }
    
  3. The Operator collects the payment method and amount from the player and calls the /make_payment API endpoint.

    curl --request POST \
         --url https://api.paynearme-sandbox.com/json-api/make_payment \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
      "site_identifier": "S6404173951",
      "timestamp": "1722289425",
      "version": "3.0",
      "signature": "c341226221bede672b3ad9e6376016c21df8adaf5f69a6266fea46c847291c81",
      "payment_method_identifier": "23b9e4ba13242",
      "payment_amount": "1000",
      "payment_currency": "USD",
      "site_channel": "consumer",
      "pnm_order_identifier": "84274665124"
    }
    '
    
  4. The response indicates that the bank authorization has expired.

    {
      "response_code": "6513",
      "status": "error",
      "errors": [
        {
          "description": "Your payment token is expired, please connect your bank account again to make payment. (ref 730659930190)"
        }
      ]
    }
    
  5. The Operator calls the /get_smart_token endpoint again with the payment_method_identifier included in the flow_trustly_reconnect parameter. This will return a specific URL where the player can input his or her bank credentials again to refresh the authorization token.

    curl --request POST \
         --url https://api.paynearme-sandbox.com/json-api/get_smart_token \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
      "flow_bank_oauth_redirect_url":"freehold-gaming://freehold.us/cashier/deposit/status/82882345534",
      "flow_no_pay_url":"freehold-gaming://portal.freehold.us/cashier/deposit/ach",
      "flow_no_add_url":"freehold-gaming://portal.freehold.us/cashier/deposit/ach",
      "flow_add_url":"freehold-gaming://portal.freehold.us/cashier/deposit/status/82882345534",
      "flow_pay_url":" freehold-gaming://portal.freehold.us/cashier/deposit/status/82882345534",
      "flow_return_url":"freehold-gaming://portal.freehold.us/cashier",
      "flow_trustly":"true",
      "flow_trustly_reconnect":"23b9e4ba13242",
      "pnm_order_identifier":"82882345534",
      "site_identifier": "S6404173951",
      "timestamp": "1721943463",
      "version": "3.0",
      "signature": "68bdeeeeb14b09dfee92ccab3ec5fdfb7139c09ec22470867894ac71e51d65b5"
    }
    '
    
  6. The player completes the bank login and account selection and then PayNearMe redirects him or her back to the flow_add_url that was sent in the /get_smart_token call.

  7. The Operator calls the /make_payment endpoint again.

    curl --request POST \
         --url https://api.paynearme-sandbox.com/json-api/make_payment \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
      "site_identifier": "S6404173951",
      "timestamp": "1722289758",
      "version": "3.0",
      "signature": "c341226221bede672b3ad9e6376016c21df8adaf5f69a6266fea46c847291c81",
      "payment_method_identifier": "23b9e4ba13242",
      "payment_amount": "1000",
      "payment_currency": "USD",
      "site_channel": "consumer",
      "pnm_order_identifier": "84274665124"
    }
    '
    
  8. If configured, PayNearMe sends the Authorization callback to the Operator.

    {
      "pnm_order_identifier": "84274665124",
      "pnm_payment_identifier": "943751749956",
      "site_order_identifier": "6969248991",
      "site_customer_identifier": "184120000",
      "version": "3.0",
      "test": true,
      "payment_amount": "1000.00",
      "payment_currency": "USD",
      "payment_date": "1722289426",
      "net_payment_amount": "1000.00",
      "net_payment_currency": "USD",
      "pnm_withheld_amount": "20.20",
      "pnm_withheld_currency": "USD",
      "due_to_site_amount": "979.80",
      "due_to_site_currency": "USD",
      "payment_type": "ach",
      "site_identifier": "S6404173951",
      "payment_bank_name": "Demo Savings Account",
      "payment_bank_last4": "6213",
      "timestamp": "1722289426",
      "signature": "6252aaef2fd78d83e17426e6e56fd80410c9dc3b3b312e1d5be1bba3bde5e5a4"
    }
    
    
  9. If the transaction is authorized, the Operator responds to the callback with the order’s pnm_order_identifier.

  10. The Operator displays a “Thank you for your deposit” message to the player.

  11. PayNearMe sends the Operator a Confirmation callback with the payment details.

    {
      "pnm_order_identifier": "84274665124",
      "pnm_payment_identifier": "943751749956",
      "site_customer_identifier": "184120000",
      "site_payment_identifier": "992761bd-e5eb-4a40-a53b-68de6e90dbf7",
      "version": "3.0",
      "net_payment_amount": "1000.00",
      "net_payment_currency": "USD",
      "payment_amount": "1000.00",
      "payment_currency": "USD",
      "timestamp": "1722289537",
      "status": "payment",
      "pnm_withheld_amount": "20.20",
      "pnm_withheld_currency": "USD",
      "due_to_site_amount": "979.80",
      "due_to_site_currency": "USD",
      "due_to_parent_amount": "0.00",
      "due_to_parent_currency": "USD",
      "due_to_child_amount": "979.80",
      "due_to_child_currency": "USD",
      "standin": "false",
      "payment_timestamp": "2024-07-30 09:32:23 -0700",
      "order_payee_identifier": "S6404173951",
      "payment_type": "ach",
      "site_identifier": "S6404173951",
      "payment_bank_name": "Demo Savings Account ",
      "payment_bank_last4": "6213",
    }
    
  12. The Operator responds to the callback with the order’s pnm_order_identifier and updates the player’s balance(s) in their system.