Confirm a payment - WalletConnect Pay Docs

Confirm a payment

cURL

curl --request POST \
  --url https://api.pay.walletconnect.com/v1/gateway/payment/{id}/confirm \
  --header 'Api-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "collectedData": {
    "fields": [
      {
        "id": "fullName",
        "value": "John Smith"
      },
      {
        "id": "dob",
        "value": "1990-01-01"
      },
      {
        "id": "tosConfirmed",
        "value": "true"
      },
      {
        "id": "pobCountry",
        "value": "US"
      },
      {
        "id": "pobAddress",
        "value": "New York, NY"
      }
    ]
  },
  "excludeFromRelayer": null,
  "optionId": "opt_123",
  "results": [
    {
      "data": [
        "0x123"
      ],
      "type": "walletRpc"
    }
  ]
}
'```

### Python

```python
import requests

url = "https://api.pay.walletconnect.com/v1/gateway/payment/{id}/confirm"

payload = {
    "collectedData": { "fields": [
            {
                "id": "fullName",
                "value": "John Smith"
            },
            {
                "id": "dob",
                "value": "1990-01-01"
            },
            {
                "id": "tosConfirmed",
                "value": "true"
            },
            {
                "id": "pobCountry",
                "value": "US"
            },
            {
                "id": "pobAddress",
                "value": "New York, NY"
            }
        ] },
    "excludeFromRelayer": None,
    "optionId": "opt_123",
    "results": [
        {
            "data": ["0x123"],
            "type": "walletRpc"
        }
    ]
}
headers = {
    "Api-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

JavaScript (Fetch API)

const options = {
  method: 'POST',
  headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    collectedData: {
      fields: [
        {id: 'fullName', value: 'John Smith'},
        {id: 'dob', value: '1990-01-01'},
        {id: 'tosConfirmed', value: 'true'},
        {id: 'pobCountry', value: 'US'},
        {id: 'pobAddress', value: 'New York, NY'}
      ]
    },
    excludeFromRelayer: null,
    optionId: 'opt_123',
    results: [{data: ['0x123'], type: 'walletRpc'}]
  })
};

fetch('https://api.pay.walletconnect.com/v1/gateway/payment/{id}/confirm', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.pay.walletconnect.com/v1/gateway/payment/{id}/confirm",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'collectedData' => [
        'fields' => [
                [
                    'id' => 'fullName',
                    'value' => 'John Smith'
                ],
                [
                    'id' => 'dob',
                    'value' => '1990-01-01'
                ],
                [
                    'id' => 'tosConfirmed',
                    'value' => 'true'
                ],
                [
                    'id' => 'pobCountry',
                    'value' => 'US'
                ],
                [
                    'id' => 'pobAddress',
                    'value' => 'New York, NY'
                ]
        ]
    ],
    'excludeFromRelayer' => null,
    'optionId' => 'opt_123',
    'results' => [
        [
                'data' => [
                                '0x123'
                ],
                'type' => 'walletRpc'
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Api-Key: <api-key>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://api.pay.walletconnect.com/v1/gateway/payment/{id}/confirm"

payload := strings.NewReader("{\n  \"collectedData\": {\n    \"fields\": [\n      {\n        \"id\": \"fullName\",\n        \"value\": \"John Smith\"\n      },\n      {\n        \"id\": \"dob\",\n        \"value\": \"1990-01-01\"\n      },\n      {\n        \"id\": \"tosConfirmed\",\n        \"value\": \"true\"\n      },\n      {\n        \"id\": \"pobCountry\",\n        \"value\": \"US\"\n      },\n      {\n        \"id\": \"pobAddress\",\n        \"value\": \"New York, NY\"\n      }\n    ]\n  },\n  \"excludeFromRelayer\": null,\n  \"optionId\": \"opt_123\",\n  \"results\": [\n    {\n      \"data\": [\n        \"0x123\"\n      ],\n      \"type\": \"walletRpc\"\n    }\n  ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Api-Key", "<api-key>")
    req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Responses

Success (200)

{
  "info": null,
  "isFinal": true,
  "pollInMs": null,
  "status": "succeeded"
}

Error Responses

{
  "message": "<string>"
}

Authorizations

Headers