Wallet addresses
Each payment account belonging to your users (for example, your customers) must have at least one associated wallet address for the account to be able to send and receive payments over Interledger and Open Payments. A wallet address serves as a publicly shareable standardized ID for a payment account.
Create wallet addresses
There are a few ways in which you can create wallet addresses.
Create wallet addresses through a script
Writing your own script that loops through your list of account is one way to batch create wallet addresses for your existing account holders.
Ensure your script calls the createWalletAddress
GraphQL mutation.
mutation CreateWalletAddress($input: CreateWalletAddressInput!) { createWalletAddress(input: $input) { code success message walletAddress { id createdAt publicName url asset { code id scale } } }}
We strongly recommend you store at least the walletAddress.id
in your internal database to be able to reference the account and wallet address later.
{ "input": { "assetId": "0ddc0b7d-1822-4213-948e-915dda58850b", "publicName": "Sarah Marshall", "url": "https://example.wallet.com/sarah", "additionalProperties": [ { "key": "iban", "value": "NL93 8601 1117 947", "visibleInOpenPayments": false }, { "key": "nickname", "value": "S Mar", "visibleInOpenPayments": true } ] }}
For more information about this mutation’s input object, see CreateWalletAddressInput
.
{ "data": { "createWalletAddress": { "code": "200", "success": true, "message": "Created wallet address", "walletAddress": { "id": "695e7546-1803-4b45-96b6-6a53f4082018", "createdAt": "2023-03-03T09:07:01.107Z", "publicName": "Sarah Marshall", "url": "https://example.wallet.com/sarah", "asset": { "id": "0ddc0b7d-1822-4213-948e-915dda58850b", "code": "USD", "scale": 2 } } } }}
Create wallet addresses in response to a webhook event
The wallet_address.not_found
event fires when a wallet address is requested through the Open Payments Get Wallet Address API, but Rafiki can’t find the address.
When you receive the event, look up the associated account in your system, then call the createWalletAddress
mutation to create a wallet address for the account.
The mutation and example JSON request/response is the same as what’s given above.