diff --git a/docs/src/content/docs/guides/accept-otp-online-purchase.mdx b/docs/src/content/docs/guides/accept-otp-online-purchase.mdx
index 80732e56..493a4870 100644
--- a/docs/src/content/docs/guides/accept-otp-online-purchase.mdx
+++ b/docs/src/content/docs/guides/accept-otp-online-purchase.mdx
@@ -74,6 +74,16 @@ Call the [Get Wallet Address API](/apis/wall
let retailer_wallet_address = client.wallet_address().get("https://happylifebank.example.com/retailer").await?;
```
+
+ ```php wrap
+ $customerWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/customer'
+ ]);
+ $retailerWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://happylifebank.example.com/retailer'
+ ]);
+ ```
+
@@ -132,6 +142,25 @@ let retailer_incoming_payment_grant = client
````
+
+```php wrap
+
+$retailerIncomingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $retailerWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['read', 'complete', 'create', 'list']
+ ]
+ ]
+ ]
+ ]
+```
+
@@ -209,6 +238,24 @@ Some(&retailer_incoming_payment_grant.access_token.value),
````
+
+```php wrap
+$retailerIncomingPayment = $client->incomingPayment()->create(
+ [
+ 'url' => $retailerWalletAddress->resourceServer,
+ 'accessToken' => $retailerIncomingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $retailerWalletAddress->id,
+ 'incomingAmount' => [
+ 'value' => '140000',
+ 'assetCode' => 'MXN',
+ 'assetScale' => 2
+ ]
+ ]
+);
+```
+
@@ -283,6 +330,25 @@ let customer_quote_grant = client
````
+
+```php wrap
+$customerQuoteGrant = $client->grant()->request(
+ [
+ 'url' => $customerWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'quote',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+);
+```
+
@@ -358,6 +424,21 @@ Some(&customer_quote_grant.access_token.value),
````
+
+```php wrap
+$customerQuote = $client->quote()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerQuoteGrant->access_token->value
+ ],
+ [
+ 'method' => 'ilp',
+ 'walletAddress' => $customerWalletAddress->id,
+ 'receiver' => $retailerIncomingPayment->id
+ ]
+);
+```
+
The response returns a `receiveAmount`, a `debitAmount`, and other required information.
@@ -467,6 +548,41 @@ Outgoing payments require an interactive grant. This type of grant will obtain t
.await?;
```
+
+ ```php wrap
+ $pendingCustomerOutgoingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $customerWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $customerWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['create'],
+ 'limits' => [
+ 'debitAmount' => [
+ 'assetCode' => 'MXN',
+ 'assetScale' => 2,
+ 'value' => '140000'
+ ]
+ ]
+ ]
+ ]
+ ],
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://paymentplatform.example/finish/{...}', // where to redirect the customer after they've completed the interaction
+ 'nonce' => 'NONCE'
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -546,6 +662,19 @@ Some(&continue_field.access_token.value),
````
+
+```php wrap
+$customerOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'url' => $pendingCustomerOutgoingPaymentGrant->continue->uri,
+ 'accessToken' => $pendingCustomerOutgoingPaymentGrant->continue->access_token->value
+ ],
+ [
+ 'interact_ref' => $interactRef
+ ]
+);
+```
+
@@ -617,6 +746,20 @@ Use the access token returned in Step 9 to call the
+ ```php wrap
+ $customerOutgoingPayment = $client->outgoingPayment()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $customerWalletAddress->id,
+ 'quoteId' => $customerQuote->id
+ ]
+ );
+ ```
+
If the request fails because of an expired quote, [request a new quote](#5-request-the-creation-of-a-quote-resource) and try again.
diff --git a/docs/src/content/docs/guides/onetime-remittance-fixed-debit.mdx b/docs/src/content/docs/guides/onetime-remittance-fixed-debit.mdx
index 4ec67495..43e25ee1 100644
--- a/docs/src/content/docs/guides/onetime-remittance-fixed-debit.mdx
+++ b/docs/src/content/docs/guides/onetime-remittance-fixed-debit.mdx
@@ -84,6 +84,16 @@ Call the [Get Wallet Address API](/apis/wall
let recipient_wallet_address = client.wallet_address().get("https://happylifebank.example.com/recipient").await?;
```
+
+ ```php wrap
+ $senderWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/sender'
+ ]);
+ $recipientWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://happylifebank.example.com/recipient'
+ ]);
+ ```
+
@@ -151,6 +161,22 @@ This call obtains an access token that allows your app to request that an incomi
.await?;
```
+
+ ```php wrap
+ $recipientIncomingPaymentGrant = $client->grant()->request([
+ 'url' => $recipientWalletAddress->authServer
+ ], [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]);
+ ```
+
@@ -219,6 +245,16 @@ This call requests an incoming payment resource be created on the recipient's wa
.await?;
```
+
+ ```php wrap
+ $recipientIncomingPayment = $client->incomingPayment()->create([
+ 'url' => $recipientWalletAddress->resourceServer,
+ 'accessToken' => $recipientIncomingPaymentGrant->access_token->value
+ ], [
+ 'walletAddress' => $recipientWalletAddress->id
+ ]);
+ ```
+
@@ -287,6 +323,24 @@ This call obtains an access token that allows your app to request that a quote r
.await?;
```
+
+ ```php wrap
+ $senderQuoteGrant = $client->grant()->request(
+ [
+ 'url' => $senderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'quote',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]);
+ ```
+
@@ -368,6 +422,26 @@ The `debitAmount` specifies that the sender will pay exactly $100 USD, and the r
.await?;
```
+
+ ```php wrap
+ $senderQuote = $client->quote()->create(
+ [
+ 'url' => $senderWalletAddress->resourceServer,
+ 'accessToken' => $senderQuoteGrant->access_token->value
+ ],
+ [
+ 'method' => 'ilp',
+ 'walletAddress' => $senderWalletAddress->id,
+ 'receiver' => $recipientIncomingPayment->id,
+ 'debitAmount' => [
+ 'value' => '10000', // Sender pays exactly $100.00 USD
+ 'assetCode' => 'USD',
+ 'assetScale' => 2
+ ]
+ ]
+ );
+ ```
+
The response returns a `receiveAmount`, a `debitAmount`, and other required information.
@@ -500,6 +574,41 @@ let pending_sender_outgoing_payment_grant = client
````
+
+ ```php wrap
+ $pendingSenderOutgoingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $senderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $senderWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['create'],
+ 'limits' => [
+ 'debitAmount' => [
+ 'assetCode' => 'USD',
+ 'assetScale' => 2,
+ 'value' => '10000' // Sender pays exactly $100.00 USD
+ ]
+ ]
+ ]
+ ]
+ ],
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://myapp.example.com/finish/{...}', // where to redirect your user after they've completed the interaction
+ 'nonce' => 'NONCE'
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -578,6 +687,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
.await?;
```
+
+ ```php wrap
+ $senderOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'url' => $pendingSenderOutgoingPaymentGrant->continue->uri,
+ 'accessToken' => $pendingSenderOutgoingPaymentGrant->continue->access_token->value
+ ],
+ [
+ 'interact_ref' => $interactRef
+ ]
+ );
+ ```
+
@@ -649,6 +771,20 @@ Use the access token returned in Step 9 to call the
+ ```php wrap
+ $senderOutgoingPayment = $client->outgoingPayment()->create(
+ [
+ 'url' => $senderWalletAddress->resourceServer,
+ 'accessToken' => $senderOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $senderWalletAddress->id,
+ 'quoteId' => $senderQuote->id
+ ]
+ );
+ ```
+
If the request fails because of an expired quote, [request a new quote](#5-request-the-creation-of-a-quote-resource) and try again.
diff --git a/docs/src/content/docs/guides/onetime-remittance-fixed-receive.mdx b/docs/src/content/docs/guides/onetime-remittance-fixed-receive.mdx
index b07caadf..3aeb209c 100644
--- a/docs/src/content/docs/guides/onetime-remittance-fixed-receive.mdx
+++ b/docs/src/content/docs/guides/onetime-remittance-fixed-receive.mdx
@@ -85,6 +85,16 @@ Call the [Get Wallet Address API](/apis/wall
let recipient_wallet_address = client.wallet_address().get("https://happylifebank.example.com/recipient").await?;
```
+
+ ```php wrap
+ $senderWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/sender'
+ ]);
+ $recipientWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://happylifebank.example.com/recipient'
+ ]);
+ ```
+
@@ -156,6 +166,25 @@ let recipient_incoming_payment_grant = client
````
+
+ ```php wrap
+ $recipientIncomingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $recipientWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['create']
+ ],
+ ],
+ ],
+ ]
+ );
+ ```
+
@@ -225,6 +254,19 @@ Some(&recipient_incoming_payment_grant.access_token.value),
````
+
+ ```php wrap
+ $recipientIncomingPayment = $client->incomingPayment()->create(
+ [
+ 'url' => $recipientWalletAddress->resourceServer,
+ 'accessToken' => $recipientIncomingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $recipientWalletAddress->id,
+ ]
+ );
+ ```
+
@@ -299,6 +341,25 @@ let sender_quote_grant = client
````
+
+ ```php wrap
+ $senderQuoteGrant = $client->grant()->request(
+ [
+ 'url' => $senderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'quote',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -380,6 +441,26 @@ Some(&sender_quote_grant.access_token.value),
````
+
+ ```php wrap
+ $senderQuote = $client->quote()->create(
+ [
+ 'url' => $senderWalletAddress->resourceServer,
+ 'accessToken' => $senderQuoteGrant->access_token->value
+ ],
+ [
+ 'method' => 'ilp',
+ 'walletAddress' => $senderWalletAddress->id,
+ 'receiver' => $recipientIncomingPayment->id,
+ 'receiveAmount' => [
+ 'value' => '500000',
+ 'assetCode' => 'MXN',
+ 'assetScale' => 2
+ ]
+ ]
+ );
+ ```
+
The response returns a `receiveAmount`, a `debitAmount`, and other required information.
@@ -508,6 +589,41 @@ let pending_sender_outgoing_payment_grant = client
````
+
+ ```php wrap
+ $pendingSenderOutgoingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $senderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $senderWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['create'],
+ 'limits' => [
+ 'receiveAmount' => [
+ 'assetCode' => 'MXN',
+ 'assetScale' => 2,
+ 'value' => '500000'
+ ]
+ ]
+ ]
+ ]
+ ],
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://myapp.example.com/finish/{...}', // where to redirect your user after they've completed the interaction
+ 'nonce' => 'NONCE'
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -586,6 +702,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
.await?;
```
+
+ ```php wrap
+ $senderOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'url' => $pendingSenderOutgoingPaymentGrant->continue->uri,
+ 'accessToken' => $pendingSenderOutgoingPaymentGrant->continue->access_token->value
+ ],
+ [
+ 'interact_ref' => $interactRef
+ ]
+ );
+ ```
+
@@ -656,6 +785,20 @@ Use the access token returned in Step 9 to call the
+ ```php wrap
+ $senderOutgoingPayment = $client->outgoingPayment()->create(
+ [
+ 'url' => $senderWalletAddress->resourceServer,
+ 'accessToken' => $senderOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $senderWalletAddress->id,
+ 'quoteId' => $senderQuote->id
+ ]
+ );
+ ```
+
If the request fails because of an expired quote, [request a new quote](#5-request-the-creation-of-a-quote-resource) and try again.
diff --git a/docs/src/content/docs/guides/outgoing-grant-future-payments.mdx b/docs/src/content/docs/guides/outgoing-grant-future-payments.mdx
index 82b67c7f..986571a0 100644
--- a/docs/src/content/docs/guides/outgoing-grant-future-payments.mdx
+++ b/docs/src/content/docs/guides/outgoing-grant-future-payments.mdx
@@ -55,6 +55,13 @@ Let's assume your user saved their wallet address in their account profile when
let user_wallet_address = client.wallet_address().get("https://cloudninebank.example.com/user").await?;
```
+
+ ```php wrap
+ $userWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/user'
+ ]);
+ ```
+
@@ -143,6 +150,43 @@ Remember, your user wants to send payments of up to $100 CAD a month for three m
.await?;
```
+
+ ```php wrap
+ $grant = $client->grant()->request(
+ [
+ 'url' => $userWalletAddress->authServer,
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $userWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['read', 'create'],
+ 'limits' => [
+ 'interval' => 'R3/2025-05-20T13:00:00Z/P1M',
+ 'debitAmount' => [
+ 'assetCode' => 'CAD',
+ 'assetScale' => 2,
+ 'value' => '10000',
+ ],
+ ],
+ ],
+ ],
+ ],
+ 'client' => $userWalletAddress->id,
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://paymentplatform.example/finish/{...}', // where to redirect the user to after they've completed the interaction
+ 'nonce' => NONCE,
+ ],
+ ],
+ ],
+ );
+ ```
+
@@ -234,6 +278,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
.await?;
```
+
+ ```php wrap
+ $userOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'accessToken' => $pendingUserOutgoingPaymentGrant->continue->access_token->value,
+ 'url' => $pendingUserOutgoingPaymentGrant->continue->uri,
+ ],
+ [
+ 'interact_ref' => $interactRef,
+ ],
+ );
+ ```
+
A successful response provides your app with an access token. Now your app can issue outgoing payment requests to future recipients against the grant. Each request must reference the access token.
diff --git a/docs/src/content/docs/guides/recurring-remittance-fixed-debit.mdx b/docs/src/content/docs/guides/recurring-remittance-fixed-debit.mdx
index bd685fee..ee526cd2 100644
--- a/docs/src/content/docs/guides/recurring-remittance-fixed-debit.mdx
+++ b/docs/src/content/docs/guides/recurring-remittance-fixed-debit.mdx
@@ -78,6 +78,16 @@ Call the [Get Wallet Address API](/apis/wall
})
```
+
+ ```php wrap
+ $senderWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/sender'
+ ]);
+ $recipientWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://happylifebank.example.com/recipient'
+ ]);
+ ```
+
@@ -132,6 +142,25 @@ This call obtains an access token that allows your app to request an incoming pa
);
```
+
+ ```php wrap
+ $recipientIncomingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $recipientWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['create'],
+ ],
+ ],
+ ],
+ ]
+ );
+ ```
+
@@ -179,6 +208,19 @@ This call requests an incoming payment resource be created on the recipient's wa
)
```
+
+ ```php wrap
+ $recipientIncomingPayment = $client->incomingPayment()->create(
+ [
+ 'url' => $recipientWalletAddress->resourceServer,
+ 'accessToken' => $recipientIncomingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $recipientWalletAddress->id
+ ]
+ );
+ ```
+
@@ -258,6 +300,42 @@ Outgoing payments require an interactive grant, which the sender approves once.
)
```
+
+ ```php wrap
+ $pendingSenderOutgoingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $senderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $senderWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['create'],
+ 'limits' => [
+ 'interval' => 'R3/2025-10-03T23:25:00Z/P1M',
+ 'debitAmount' => [
+ 'assetCode' => 'USD',
+ 'assetScale' => 2,
+ 'value' => '20000', // $200.00 USD per interval
+ ]
+ ]
+ ]
+ ]
+ ],
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://myapp.example.com/finish/{...}', // where to redirect your user after they've completed the interaction
+ 'nonce' => NONCE
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -331,6 +409,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
)
```
+
+ ```php wrap
+ $senderOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'url' => $pendingSenderOutgoingPaymentGrant->continue->uri,
+ 'accessToken' => $pendingSenderOutgoingPaymentGrant->continue->access_token->value
+ ],
+ [
+ 'interact_ref' => $interactRef
+ ]
+ );
+ ```
+
@@ -391,6 +482,25 @@ Use the access token returned in the outgoing payment grant continuation respons
)
```
+
+ ```php wrap
+ $senderOutgoingPayment = $client->outgoingPayment()->create(
+ [
+ 'url' => $senderWalletAddress->resourceServer,
+ 'accessToken' => $senderOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $senderWalletAddress->id,
+ 'incomingPayment' => $recipientIncomingPayment->id,
+ 'debitAmount' => [
+ 'assetCode' => 'USD',
+ 'assetScale' => 2,
+ 'value' => '20000'
+ ],
+ ]
+ );
+ ```
+
diff --git a/docs/src/content/docs/guides/recurring-remittance-fixed-receive.mdx b/docs/src/content/docs/guides/recurring-remittance-fixed-receive.mdx
index 02a3f606..2132f8d7 100644
--- a/docs/src/content/docs/guides/recurring-remittance-fixed-receive.mdx
+++ b/docs/src/content/docs/guides/recurring-remittance-fixed-receive.mdx
@@ -81,6 +81,16 @@ Call the [Get Wallet Address API](/apis/wall
})
```
+
+ ```php wrap
+ $senderWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/sender'
+ ]);
+ $recipientWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://happylifebank.example.com/recipient'
+ ]);
+ ```
+
@@ -161,6 +171,42 @@ Outgoing payments require an interactive grant, which the sender approves once.
)
```
+
+ ```php wrap
+ $pendingSenderOutgoingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $senderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $senderWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['create'],
+ 'limits' => [
+ 'interval' => 'R3/2025-10-03T23:25:00Z/P1M',
+ 'receiveAmount' => [
+ 'assetCode' => 'MXN',
+ 'assetScale' => 2,
+ 'value' => '400000',
+ ]
+ ]
+ ]
+ ]
+ ],
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://myapp.example.com/finish/{...}', // where to redirect your user after they've completed the interaction
+ 'nonce' => NONCE
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -234,6 +280,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
)
```
+
+ ```php wrap
+ $senderOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'url' => $pendingSenderOutgoingPaymentGrant->continue->uri,
+ 'accessToken' => $pendingSenderOutgoingPaymentGrant->continue->access_token->value
+ ],
+ [
+ 'interact_ref' => $interactRef
+ ]
+ );
+ ```
+
@@ -296,6 +355,25 @@ This call obtains an access token that allows your app to request an incoming pa
);
```
+
+ ```php wrap
+ $recipientIncomingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $recipientWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['create'],
+ ],
+ ],
+ ],
+ ]
+ );
+ ```
+
@@ -343,6 +421,19 @@ This call requests an incoming payment resource be created on the recipient's wa
)
```
+
+ ```php wrap
+ $recipientIncomingPayment = $client->incomingPayment()->create(
+ [
+ 'url' => $recipientWalletAddress->resourceServer,
+ 'accessToken' => $recipientIncomingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $recipientWalletAddress->id,
+ ]
+ );
+ ```
+
@@ -396,6 +487,25 @@ This call obtains an access token that allows your app to request a quote resour
)
```
+
+ ```php wrap
+ $senderQuoteGrant = $client->grant()->request(
+ [
+ 'url' => $senderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'quote',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -452,6 +562,26 @@ The `receiveAmount` specifies that the recipient will receive exactly $4,000 MXN
)
```
+
+ ```php wrap
+ $senderQuote = $client->quote()->create(
+ [
+ 'url' => $senderWalletAddress->resourceServer,
+ 'accessToken' => $senderQuoteGrant->access_token->value
+ ],
+ [
+ 'method' => 'ilp',
+ 'walletAddress' => $senderWalletAddress->id,
+ 'receiver' => $recipientIncomingPayment->id,
+ 'receiveAmount' => [
+ 'value' => '400000',
+ 'assetCode' => 'MXN',
+ 'assetScale' => 2
+ ]
+ ]
+ );
+ ```
+
The response returns a `receiveAmount`, a `debitAmount`, and other required information.
@@ -507,6 +637,20 @@ Use the access token returned in the outgoing payment grant continuation respons
)
```
+
+ ```php wrap
+ $senderOutgoingPayment = $client->outgoingPayment()->create(
+ [
+ 'url' => $senderWalletAddress->resourceServer,
+ 'accessToken' => $senderOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $senderWalletAddress->id,
+ 'quoteId' => $senderQuote->id,
+ ]
+ );
+ ```
+
diff --git a/docs/src/content/docs/guides/recurring-subscription-incoming-amount.mdx b/docs/src/content/docs/guides/recurring-subscription-incoming-amount.mdx
index 5e0ade9a..5c0b4995 100644
--- a/docs/src/content/docs/guides/recurring-subscription-incoming-amount.mdx
+++ b/docs/src/content/docs/guides/recurring-subscription-incoming-amount.mdx
@@ -79,6 +79,16 @@ Call the [Get Wallet Address API](/apis/wall
})
```
+
+ ```php wrap
+ $customerWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/customer'
+ ]);
+ $serviceProviderWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://happylifebank.example.com/service-provider'
+ ]);
+ ```
+
@@ -131,6 +141,25 @@ This call obtains an access token that allows you to request that an incoming pa
);
```
+
+ ```php wrap
+ $serviceProviderIncomingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $serviceProviderWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -184,6 +213,24 @@ This call requests an incoming payment resource be created on the service provid
},
)
```
+
+
+ ```php wrap
+ $serviceProviderIncomingPayment = $client->incomingPayment()->create(
+ [
+ 'url' => $serviceProviderWalletAddress->resourceServer,
+ 'accessToken' => $serviceProviderIncomingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $serviceProviderWalletAddress->id,
+ 'incomingAmount' => [
+ 'value' => '1500', // The amount the service provider expects to receive in the first payment
+ 'assetCode' => 'USD',
+ 'assetScale' => 2
+ ],
+ ]
+ );
+ ```
@@ -245,6 +292,25 @@ This call obtains an access token that allows you to request that a quote resour
)
```
+
+ ```php wrap
+ $customerQuoteGrant = $client->grant()->request(
+ [
+ 'url' => $customerWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'quote',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -298,6 +364,21 @@ The request must contain the `receiver`, which is the `id` of the service provid
)
```
+
+ ```php wrap
+ $customerQuote = $client->quote()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerQuoteGrant->access_token->value
+ ],
+ [
+ 'method' => 'ilp',
+ 'walletAddress' => $customerWalletAddress->id,
+ 'receiver' => $serviceProviderIncomingPayment->id,
+ ]
+ );
+ ```
+
The response returns a `debitAmount`, a `receiveAmount`, and other required information.
@@ -385,6 +466,42 @@ For recurring payments, include the `interval` property to specify how often the
)
```
+
+ ```php wrap
+ $pendingCustomerOutgoingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $customerWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $customerWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['create', 'read'],
+ 'limits' => [
+ 'debitAmount' => [
+ 'assetCode' => 'USD',
+ 'assetScale' => 2,
+ 'value' => '1500',
+ ],
+ 'interval' => 'R12/2025-10-14T00:03:00Z/P1M'
+ ]
+ ]
+ ]
+ ],
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://myapp.example.com/finish/{...}', // where to redirect the customer after they've completed interaction
+ 'nonce' => NONCE
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -456,6 +573,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
)
```
+
+ ```php wrap
+ $customerOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'url' => $pendingCustomerOutgoingPaymentGrant->continue->uri,
+ 'accessToken' => $pendingCustomerOutgoingPaymentGrant->continue->access_token->value
+ ],
+ [
+ 'interact_ref' => $interactRef
+ ]
+ );
+ ```
+
@@ -515,6 +645,20 @@ Include the `quoteId` from the quote created in Step 5.
)
```
+
+ ```php wrap
+ $customerOutgoingPayment = $client->outgoingPayment()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $customerWalletAddress->id,
+ 'quoteId' => $customerQuote->id
+ ]
+ );
+ ```
+
diff --git a/docs/src/content/docs/guides/split-payments.mdx b/docs/src/content/docs/guides/split-payments.mdx
index dc9c6a48..3fe1dcac 100644
--- a/docs/src/content/docs/guides/split-payments.mdx
+++ b/docs/src/content/docs/guides/split-payments.mdx
@@ -77,6 +77,19 @@ Call the [Get Wallet Address API](/apis/wall
let platform_wallet_address = client.wallet_address().get("https://coolwallet.example.com/platform").await?;
```
+
+ ```php wrap
+ $customerWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://cloudninebank.example.com/customer'
+ ]);
+ $merchantWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://happylifebank.example.com/merchant'
+ ]);
+ $platformWalletAddress = $client->walletAddress()->get([
+ 'url' => 'https://coolwallet.example.com/platform'
+ ]);
+```
+
@@ -158,6 +171,42 @@ If you and the merchant use the same account servicing entity, and as a result,
.await?;
```
+
+ ```php wrap
+ // Merchant
+ $merchantIncomingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $merchantWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+ );
+ // Platform
+ $platformIncomingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $platformWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -256,6 +305,40 @@ Remember that the merchant is receiving 99% of the payment (\$99.00 or `9900`) w
.await?;
```
+
+ ```php wrap
+ // Merchant
+ $merchantIncomingPayment = $client->incomingPayment()->create(
+ [
+ 'url' => $merchantWalletAddress->resourceServer,
+ 'accessToken' => $merchantIncomingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $merchantWalletAddress->id,
+ 'incomingAmount' => [
+ 'value' => '9900',
+ 'assetCode' => 'USD',
+ 'assetScale' => 2
+ ]
+ ]
+ );
+ // Platform
+ $platformIncomingPayment = $client->incomingPayment()->create(
+ [
+ 'url' => $platformWalletAddress->resourceServer,
+ 'accessToken' => $platformIncomingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $platformWalletAddress->id,
+ 'incomingAmount' => [
+ 'value' => '100',
+ 'assetCode' => 'USD',
+ 'assetScale' => 2
+ ]
+ ]
+ );
+ ```
+
@@ -331,6 +414,25 @@ This call obtains an access token that allows your platform to request quote res
```
+
+ ```php wrap
+ $customerQuoteGrant = $client->grant()->request(
+ [
+ 'url' => $customerWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'quote',
+ 'actions' => ['create']
+ ]
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -425,6 +527,34 @@ Next, call the Create Quote API again an
.await?;
```
+
+ ```php wrap
+ // Merchant
+ $merchantQuote = $client->quote()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerQuoteGrant->access_token->value
+ ],
+ [
+ 'method' => 'ilp',
+ 'walletAddress' => $customerWalletAddress->id,
+ 'receiver' => $merchantIncomingPayment->id
+ ]
+ );
+ // Platform
+ $platformQuote = $client->quote()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerQuoteGrant->access_token->value
+ ],
+ [
+ 'method' => 'ilp',
+ 'walletAddress' => $customerWalletAddress->id,
+ 'receiver' => $platformIncomingPayment->id
+ ]
+ );
+ ```
+
Each response returns a `receiveAmount`, a `debitAmount`, and other required information.
@@ -556,6 +686,43 @@ This call obtains an access token that allows your platform to request outgoing
.await?;
```
+
+ ```php wrap
+ $combinedQuoteAmount = bcadd($merchantQuote->debitAmount->value, $platformQuote->debitAmount->value);
+
+ $pendingCustomerOutgoingPaymentGrant = $client->grant()->request(
+ [
+ 'url' => $customerWalletAddress->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'identifier' => $customerWalletAddress->id,
+ 'type' => 'outgoing-payment',
+ 'actions' => ['create'],
+ 'limits' => [
+ 'debitAmount' => [
+ 'assetCode' => 'USD',
+ 'assetScale' => 2,
+ 'value' => $combinedQuoteAmount
+ ]
+ ]
+ ]
+ ]
+ ],
+ 'interact' => [
+ 'start' => ['redirect'],
+ 'finish' => [
+ 'method' => 'redirect',
+ 'uri' => 'https://paymentplatform.example/finish/{...}', // where to redirect the customer after they've completed interaction
+ 'nonce' => 'NONCE'
+ ]
+ ]
+ ]
+ );
+ ```
+
@@ -627,6 +794,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
.await?;
```
+
+ ```php wrap
+ $customerOutgoingPaymentGrant = $client->grant()->continue(
+ [
+ 'url' => $pendingCustomerOutgoingPaymentGrant->continue->uri,
+ 'accessToken' => $pendingCustomerOutgoingPaymentGrant->continue->access_token->value
+ ],
+ [
+ 'interact_ref' => $interactRef
+ ]
+ );
+ ```
+
@@ -721,6 +901,32 @@ Use the access token returned in Step 5 that's associated with the merchant to c
.await?;
```
+
+ ```php wrap
+ // Merchant
+ $customerOutgoingPaymentToMerchant = $client->outgoingPayment()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $customerWalletAddress->id,
+ 'quoteId' => $merchantQuote->id
+ ]
+ );
+ // Platform
+ $customerOutgoingPaymentToPlatform = $client->outgoingPayment()->create(
+ [
+ 'url' => $customerWalletAddress->resourceServer,
+ 'accessToken' => $customerOutgoingPaymentGrant->access_token->value
+ ],
+ [
+ 'walletAddress' => $customerWalletAddress->id,
+ 'quoteId' => $platformQuote->id
+ ]
+ );
+ ```
+
diff --git a/docs/src/content/docs/sdk/grant-continue.mdx b/docs/src/content/docs/sdk/grant-continue.mdx
index f4a8b86c..60a6bd1c 100644
--- a/docs/src/content/docs/sdk/grant-continue.mdx
+++ b/docs/src/content/docs/sdk/grant-continue.mdx
@@ -68,18 +68,15 @@ For JavaScript, run `node path/to/directory/index.js`. View full source
diff --git a/docs/src/content/docs/sdk/grant-create-incoming.mdx b/docs/src/content/docs/sdk/grant-create-incoming.mdx
index 6b82b864..0d31460e 100644
--- a/docs/src/content/docs/sdk/grant-create-incoming.mdx
+++ b/docs/src/content/docs/sdk/grant-create-incoming.mdx
@@ -68,23 +68,20 @@ For JavaScript, run `node path/to/directory/index.js`. View full source
diff --git a/docs/src/content/docs/sdk/grant-create-outgoing.mdx b/docs/src/content/docs/sdk/grant-create-outgoing.mdx
index 918a0cc7..16f94d26 100644
--- a/docs/src/content/docs/sdk/grant-create-outgoing.mdx
+++ b/docs/src/content/docs/sdk/grant-create-outgoing.mdx
@@ -82,33 +82,22 @@ For JavaScript, run `node path/to/directory/index.js`. View full source without interval
diff --git a/docs/src/content/docs/sdk/grant-create-quote.mdx b/docs/src/content/docs/sdk/grant-create-quote.mdx
index 25095f1f..34baca40 100644
--- a/docs/src/content/docs/sdk/grant-create-quote.mdx
+++ b/docs/src/content/docs/sdk/grant-create-quote.mdx
@@ -69,20 +69,24 @@ For JavaScript, run `node path/to/directory/index.js`. View full source
diff --git a/docs/src/content/docs/sdk/grant-revoke.mdx b/docs/src/content/docs/sdk/grant-revoke.mdx
index 6aa248bb..fe107cb0 100644
--- a/docs/src/content/docs/sdk/grant-revoke.mdx
+++ b/docs/src/content/docs/sdk/grant-revoke.mdx
@@ -57,8 +57,9 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/incoming-complete.mdx b/docs/src/content/docs/sdk/incoming-complete.mdx
index bc7f592c..b9972ddb 100644
--- a/docs/src/content/docs/sdk/incoming-complete.mdx
+++ b/docs/src/content/docs/sdk/incoming-complete.mdx
@@ -85,12 +85,14 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/incoming-create.mdx b/docs/src/content/docs/sdk/incoming-create.mdx
index 1b2be279..81b8ce8b 100644
--- a/docs/src/content/docs/sdk/incoming-create.mdx
+++ b/docs/src/content/docs/sdk/incoming-create.mdx
@@ -91,11 +91,13 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
diff --git a/docs/src/content/docs/sdk/incoming-get.mdx b/docs/src/content/docs/sdk/incoming-get.mdx
index de390bc3..6f3a57e0 100644
--- a/docs/src/content/docs/sdk/incoming-get.mdx
+++ b/docs/src/content/docs/sdk/incoming-get.mdx
@@ -114,20 +114,23 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source with authentication
diff --git a/docs/src/content/docs/sdk/incoming-list.mdx b/docs/src/content/docs/sdk/incoming-list.mdx
index 3dab1fc2..824aaedd 100644
--- a/docs/src/content/docs/sdk/incoming-list.mdx
+++ b/docs/src/content/docs/sdk/incoming-list.mdx
@@ -85,16 +85,19 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/outgoing-create.mdx b/docs/src/content/docs/sdk/outgoing-create.mdx
index f30de6cb..7cdc29ad 100644
--- a/docs/src/content/docs/sdk/outgoing-create.mdx
+++ b/docs/src/content/docs/sdk/outgoing-create.mdx
@@ -95,20 +95,23 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/outgoing-list.mdx b/docs/src/content/docs/sdk/outgoing-list.mdx
index 023cac8a..e8e074de 100644
--- a/docs/src/content/docs/sdk/outgoing-list.mdx
+++ b/docs/src/content/docs/sdk/outgoing-list.mdx
@@ -85,12 +85,14 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/quote-create.mdx b/docs/src/content/docs/sdk/quote-create.mdx
index 93f23170..8976809c 100644
--- a/docs/src/content/docs/sdk/quote-create.mdx
+++ b/docs/src/content/docs/sdk/quote-create.mdx
@@ -59,14 +59,18 @@ For JavaScript, run `node path/to/directory/index.js`.
Prerequisites
+
+
{/* prettier-ignore */}
View full source
@@ -145,17 +149,21 @@ For JavaScript, run `node path/to/directory/index.js`.
Prerequisites
+
{/* prettier-ignore */}
View full source
@@ -233,18 +241,23 @@ For JavaScript, run `node path/to/directory/index.js`.
Prerequisites
+
+
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/quote-get.mdx b/docs/src/content/docs/sdk/quote-get.mdx
index d6be6873..f9e5f3b5 100644
--- a/docs/src/content/docs/sdk/quote-get.mdx
+++ b/docs/src/content/docs/sdk/quote-get.mdx
@@ -63,12 +63,14 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/token-revoke.mdx b/docs/src/content/docs/sdk/token-revoke.mdx
index da83857a..55d83ecb 100644
--- a/docs/src/content/docs/sdk/token-revoke.mdx
+++ b/docs/src/content/docs/sdk/token-revoke.mdx
@@ -59,8 +59,9 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/token-rotate.mdx b/docs/src/content/docs/sdk/token-rotate.mdx
index f85699fe..87c891bb 100644
--- a/docs/src/content/docs/sdk/token-rotate.mdx
+++ b/docs/src/content/docs/sdk/token-rotate.mdx
@@ -63,12 +63,14 @@ For JavaScript, run `node path/to/directory/index.js`.
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/wallet-get-info.mdx b/docs/src/content/docs/sdk/wallet-get-info.mdx
index 600b29a9..3ea32c3a 100644
--- a/docs/src/content/docs/sdk/wallet-get-info.mdx
+++ b/docs/src/content/docs/sdk/wallet-get-info.mdx
@@ -77,16 +77,30 @@ For JavaScript, run `node path/to/directory/index.js`.
Prerequisites
-
+
+
+
+
+
{/* prettier-ignore */}
View full source
diff --git a/docs/src/content/docs/sdk/wallet-get-keys.mdx b/docs/src/content/docs/sdk/wallet-get-keys.mdx
index 737006bf..cf6c5633 100644
--- a/docs/src/content/docs/sdk/wallet-get-keys.mdx
+++ b/docs/src/content/docs/sdk/wallet-get-keys.mdx
@@ -8,8 +8,7 @@ import ChunkedSnippet from '/src/components/ChunkedSnippet.astro'
import Begin from '/src/partials/before-you-begin.mdx'
import Ts from '/src/partials/ts-init-config.mdx'
import TsImport from '/src/partials/ts-import-initialize.mdx'
-import PhpImport from '/src/partials/php-import-initialize.mdx'
-
+
While most Open Payments code snippets are intended for clients, getting the keys bound to a wallet address is primarily a function of account servicing entities.
When an authorization server receives a signed grant request, the server can make a call to acquire the public keys bound to the wallet address. Then, when a client makes a request to a resource server, the resource server calls the auth server to ensure the signature of the request corresponds to the public JWK of the wallet address. This enables the server to ensure the client is who it says it is.
@@ -85,16 +84,30 @@ For JavaScript, run `node path/to/directory/index.js`.
Prerequisites
-
+
+
+
+
+
{/* prettier-ignore */}
View full source
diff --git a/docs/src/partials/php-import-initialize.mdx b/docs/src/partials/php-import-initialize.mdx
index 019bf84c..7c049ccb 100644
--- a/docs/src/partials/php-import-initialize.mdx
+++ b/docs/src/partials/php-import-initialize.mdx
@@ -1,10 +1,13 @@
import ChunkedSnippet from '/src/components/ChunkedSnippet.astro'
+
diff --git a/snippets/php/grant/grant-continuation.php b/snippets/php/grant/grant-continuation.php
new file mode 100644
index 00000000..53df5650
--- /dev/null
+++ b/snippets/php/grant/grant-continuation.php
@@ -0,0 +1,25 @@
+grant()->continue(
+ [
+ 'access_token' => $CONTINUE_ACCESS_TOKEN,
+ 'url' => $CONTINUE_URI
+ ],
+ [
+ 'interact_ref' => $interactRef,
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Check grant state
+if (!$grant instanceof \OpenPayments\Models\Grant) {
+ throw new \Error('Expected finalized grant. Received non-finalized grant.');
+}
+//@! end chunk 2
+
+//@! start chunk 3 | title=Output
+echo 'OUTGOING_PAYMENT_GRANT_ACCES_TOKEN: ' . $grant->access_token->value . PHP_EOL;
+echo 'OUTGOING_PAYMENT_ACCESS_TOKEN_MANAGE_URL: ' . $grant->access_token->manage . PHP_EOL;
+echo 'GRANT OBJECT: ' . PHP_EOL . print_r($grant, true);
+//@! end chunk 3
diff --git a/snippets/php/grant/grant-incoming-payment.php b/snippets/php/grant/grant-incoming-payment.php
new file mode 100644
index 00000000..865fd9c7
--- /dev/null
+++ b/snippets/php/grant/grant-incoming-payment.php
@@ -0,0 +1,36 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 1
+//@! start chunk 2 | title=Request incoming payment grant
+$grant = $opClient->grant()->request(
+ [
+ 'url' => $wallet->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'incoming-payment',
+ 'actions' => ['read', 'complete', 'create', 'list']
+ ]
+ ]
+ ]
+ ]
+);
+//@! end chunk 2
+
+//@! start chunk 3 | title=Check grant state
+if (!$grant instanceof \OpenPayments\Models\Grant) {
+ throw new \Error('Expected non-interactive grant');
+}
+//@! end chunk 3
+
+//@! start chunk 4 | title=Output
+echo 'INCOMING_PAYMENT_GRANT: ' . $grant->access_token->value . PHP_EOL;
+echo "INCOMING_PAYMENT_ACCESS_TOKEN_MANAGE_URL = " . $grant->access_token->manage . PHP_EOL;
+echo 'GRANT OBJECT: ' . PHP_EOL . print_r($grant, true);
+//@! end chunk 4
diff --git a/snippets/php/grant/grant-outgoing-payment-interval.php b/snippets/php/grant/grant-outgoing-payment-interval.php
new file mode 100644
index 00000000..00254e29
--- /dev/null
+++ b/snippets/php/grant/grant-outgoing-payment-interval.php
@@ -0,0 +1,37 @@
+grant()->request(
+ [
+ 'url' => $wallet->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'outgoing-payment',
+ 'actions' => ['list', 'list-all', 'read', 'read-all', 'create'],
+ 'identifier' => $wallet->id,
+ 'limits' => [
+ 'debitAmount' => [
+ 'assetCode' => 'USD',
+ 'assetScale' => 2,
+ 'value' => "132",
+ ],
+ 'interval' => 'R/2025-04-22T08:00:00Z/P1D',
+ ],
+ ]
+ ]
+ ],
+ 'client' => $config->getWalletAddressUrl(),
+ 'interact' => [
+ 'start' => ["redirect"],
+ 'finish' => [
+ 'method' => "redirect",
+ 'uri' => 'https://localhost/?paymentId=123423',
+ 'nonce' => "1234567890",
+ ],
+ ]
+ ]
+);
+//@! end chunk 1
diff --git a/snippets/php/grant/grant-outgoing-payment.php b/snippets/php/grant/grant-outgoing-payment.php
new file mode 100644
index 00000000..d2b7ccef
--- /dev/null
+++ b/snippets/php/grant/grant-outgoing-payment.php
@@ -0,0 +1,57 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 1
+// See https://openpayments.dev/apis/auth-server/operations/post-request/
+
+//@! start chunk 2 | title=Request outgoing payment grant
+$grant = $opClient->grant()->request(
+ [
+ 'url' => $wallet->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'outgoing-payment',
+ 'actions' => ['list', 'list-all', 'read', 'read-all', 'create'],
+ 'identifier' => $wallet->id,
+ 'limits' => [
+ 'receiver' => $INCOMING_PAYMENT_URL, //optional
+ 'debitAmount' => [
+ 'assetCode' => 'USD',
+ 'assetScale' => 2,
+ 'value' => "130",
+ ]
+ ],
+ ]
+ ]
+ ],
+ 'client' => $config->getWalletAddressUrl(),
+ 'interact' => [
+ 'start' => ["redirect"],
+ 'finish' => [
+ 'method' => "redirect",
+ 'uri' => 'https://localhost/?paymentId=123423',
+ 'nonce' => "1234567890",
+ ],
+ ]
+ ]
+);
+//@! end chunk 2
+
+//@! start chunk 3 | title=Check grant state
+if (!$grant instanceof \OpenPayments\Models\PendingGrant) {
+ throw new \Error('Expected interactive grant');
+}
+//@! end chunk 3
+
+//@! start chunk 4 | title=Output
+echo 'Please interact at the following URL: ' . $grant->interact->redirect . PHP_EOL;
+echo 'CONTINUE_ACCESS_TOKEN = ' . $grant->continue->access_token->value . PHP_EOL;
+echo 'CONTINUE_URI = ' . $grant->continue->uri . PHP_EOL;
+echo 'GRANT OBJECT: ' . PHP_EOL . print_r($grant, true);
+//@! end chunk 4
diff --git a/snippets/php/grant/grant-quote.php b/snippets/php/grant/grant-quote.php
new file mode 100644
index 00000000..e35da871
--- /dev/null
+++ b/snippets/php/grant/grant-quote.php
@@ -0,0 +1,39 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Request quote grant
+$grant = $opClient->grant()->request(
+ [
+ 'url' => $wallet->authServer
+ ],
+ [
+ 'access_token' => [
+ 'access' => [
+ [
+ 'type' => 'quote',
+ 'actions' => ['create', 'read', 'read-all']
+ ]
+ ]
+ ],
+ 'client' => $config->getWalletAddressUrl()
+ ]
+);
+//@! end chunk 2
+
+//@! start chunk 3 | title=Check grant state
+ if ($grant instanceof \OpenPayments\Models\PendingGrant) {
+ throw new \Error('Expected non-interactive grant');
+}
+//@! end chunk 3
+
+//@! start chunk 4 | title=Output
+echo 'QUOTE_ACCESS_TOKEN: ' . $grant->access_token->value . PHP_EOL;
+echo 'QUOTE_ACCESS_TOKEN_MANAGE_URL: ' . $grant->access_token->manage . PHP_EOL;
+
+echo 'GRANT OBJECT: ' . PHP_EOL . print_r($grant, true);
+//@! end chunk 4
diff --git a/snippets/php/grant/grant-revoke.php b/snippets/php/grant/grant-revoke.php
new file mode 100644
index 00000000..21157794
--- /dev/null
+++ b/snippets/php/grant/grant-revoke.php
@@ -0,0 +1,10 @@
+grant()->cancel(
+ [
+ 'access_token'=> $ACCESS_TOKEN,
+ 'url' => $CONTINUE_URI
+ ]
+);
+//@! end chunk 1
diff --git a/snippets/php/incoming-payment/incoming-payment-complete.php b/snippets/php/incoming-payment/incoming-payment-complete.php
new file mode 100644
index 00000000..30f21c58
--- /dev/null
+++ b/snippets/php/incoming-payment/incoming-payment-complete.php
@@ -0,0 +1,14 @@
+incomingPayment()->complete(
+ [
+ 'access_token' => $INCOMING_PAYMENT_GRANT_ACCESS_TOKEN,
+ 'url' => $INCOMING_PAYMENT_URL
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Output
+echo 'COMPLETE INCOMING PAYMENT: '. PHP_EOL . print_r($incomingPayment, true);
+//@! end chunk 2
diff --git a/snippets/php/incoming-payment/incoming-payment-create.php b/snippets/php/incoming-payment/incoming-payment-create.php
new file mode 100644
index 00000000..1bb47281
--- /dev/null
+++ b/snippets/php/incoming-payment/incoming-payment-create.php
@@ -0,0 +1,42 @@
+incomingPayment()->create(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $INCOMING_PAYMENT_GRANT_ACCESS_TOKEN
+ ],
+ [
+ 'walletAddress' => $config->getWalletAddressUrl(),
+ 'incomingAmount' => [
+ 'value' => "130",
+ 'assetCode' => 'USD',
+ 'assetScale' => 2
+ ],
+ 'metadata' => [
+ 'description' => 'Test php snippets transaction with $1,30 amount',
+ 'externalRef' => 'INVOICE-' . uniqid()
+ ],
+ 'expiresAt' => (new \DateTime())->add(new \DateInterval('PT59M'))->format("Y-m-d\TH:i:s.v\Z")
+ ]
+);
+//@! end chunk 3
+
+//@! start chunk 4 | title=Output
+echo 'INCOMING_PAYMENT_URL: ' . $newIncomingPayment->id . PHP_EOL;
+echo 'INCOMING PAYMENT OBJECT:' . PHP_EOL . print_r($newIncomingPayment, true);
+//@! end chunk 4
diff --git a/snippets/php/incoming-payment/incoming-payment-get-public.php b/snippets/php/incoming-payment/incoming-payment-get-public.php
new file mode 100644
index 00000000..d4e05cf7
--- /dev/null
+++ b/snippets/php/incoming-payment/incoming-payment-get-public.php
@@ -0,0 +1,9 @@
+incomingPayment()->get(
+ [
+ 'url' => $INCOMING_PAYMENT_URL
+ ]
+);
+//@! end chunk 1
diff --git a/snippets/php/incoming-payment/incoming-payment-get.php b/snippets/php/incoming-payment/incoming-payment-get.php
new file mode 100644
index 00000000..fcb1539a
--- /dev/null
+++ b/snippets/php/incoming-payment/incoming-payment-get.php
@@ -0,0 +1,14 @@
+incomingPayment()->get(
+ [
+ 'access_token' => $INCOMING_PAYMENT_GRANT_ACCESS_TOKEN,
+ 'url' => $INCOMING_PAYMENT_URL
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Output
+echo 'INCOMING PAYMENT: ' . PHP_EOL . print_r($incomingPayment, true);
+//@! end chunk 2
diff --git a/snippets/php/incoming-payment/incoming-payment-list.php b/snippets/php/incoming-payment/incoming-payment-list.php
new file mode 100644
index 00000000..0079a48e
--- /dev/null
+++ b/snippets/php/incoming-payment/incoming-payment-list.php
@@ -0,0 +1,25 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 1
+
+//@! start chunk 2 | title=List incoming payments
+$incomingPaymentsList = $opClient->incomingPayment()->list(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $INCOMING_PAYMENT_GRANT_ACCESS_TOKEN
+ ],
+ [
+ 'wallet-address' => $config->getWalletAddressUrl(),
+ 'first' => 10,
+ 'start'=> '96d964f0-3421-4df0-bb04-cb8d653bc571'
+ ]
+);
+//@! end chunk 2
+
+//@! start chunk 3 | title=Output
+echo 'INCOMING PAYMENTS ' . PHP_EOL . print_r($incomingPaymentsList, true);
+//@! end chunk 3
diff --git a/snippets/php/outgoing-payment/outgoing-payment-create.php b/snippets/php/outgoing-payment/outgoing-payment-create.php
new file mode 100644
index 00000000..438533f0
--- /dev/null
+++ b/snippets/php/outgoing-payment/outgoing-payment-create.php
@@ -0,0 +1,55 @@
+outgoingPayment()->create(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $OUTGOING_PAYMENT_GRANT_ACCESS_TOKEN
+ ],
+ [
+ 'walletAddress' => $config->getWalletAddressUrl(),
+ 'quoteId' => $QUOTE_URL,
+ 'metadata' => [
+ 'description' => 'Test outgoing payment',
+ 'reference' => '1234567890',
+ 'invoiceId' => '1234567890',
+ 'customData' => [
+ 'key1' => 'value1',
+ 'key2' => 'value2'
+ ]
+ ],
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Create outgoing payment with amount
+$newOutgoingPayment = $opClient->outgoingPayment()->create(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $OUTGOING_PAYMENT_GRANT_ACCESS_TOKEN
+ ],
+ [
+ 'walletAddress' => $config->getWalletAddressUrl(),
+ 'incomingPayment' => $INCOMING_PAYMENT_URL,
+ 'debitAmount' => [
+ 'value' => '9',
+ 'assetCode' => 'USD',
+ 'assetScale' => 2
+ ],
+ 'metadata' => [
+ 'description' => 'Test outgoing payment',
+ 'reference' => '1234567890',
+ 'invoiceId' => '1234567890',
+ 'customData' => [
+ 'key1' => 'value1',
+ 'key2' => 'value2'
+ ]
+ ],
+ ]
+);
+//@! end chunk 2
+
+//@! start chunk 3 | title=Output
+echo 'OUTGOING_PAYMENT_URL: '.$newOutgoingPayment->id . PHP_EOL;
+echo 'OUTGOING_PAYMENT OBJECT: ' . PHP_EOL . print_r($newOutgoingPayment, true) . PHP_EOL;
+//@! end chunk 3
diff --git a/snippets/php/outgoing-payment/outgoing-payment-get.php b/snippets/php/outgoing-payment/outgoing-payment-get.php
new file mode 100644
index 00000000..500dcce5
--- /dev/null
+++ b/snippets/php/outgoing-payment/outgoing-payment-get.php
@@ -0,0 +1,14 @@
+outgoingPayment()->get(
+ [
+ 'access_token' => $OUTGOING_PAYMENT_GRANT_ACCESS_TOKEN,
+ 'url' => $OUTGOING_PAYMENT_URL
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Output
+echo 'OUTGOING PAYMENT: ' . PHP_EOL . print_r($outgoingPayment, true);
+//@! end chunk 2
diff --git a/snippets/php/outgoing-payment/outgoing-payment-list.php b/snippets/php/outgoing-payment/outgoing-payment-list.php
new file mode 100644
index 00000000..213faaff
--- /dev/null
+++ b/snippets/php/outgoing-payment/outgoing-payment-list.php
@@ -0,0 +1,22 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+ //@! start chunk 1 | title=List outgoing payments
+$outgoingPaymentList = $opClient->outgoingPayment()->list(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $OUTGOING_PAYMENT_GRANT_ACCESS_TOKEN
+ ],
+ [
+ 'wallet-address' => $config->getWalletAddressUrl(),
+ 'first' => 3,
+ 'start' => '96d964f0-3421-4df0-bb04-cb8d653bc571'
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Output
+echo 'OUTGOING PAYMENTS LIST ' . PHP_EOL . print_r($outgoingPaymentList, true);
+//@! end chunk 2
diff --git a/snippets/php/quote/quote-create-debit-amount.php b/snippets/php/quote/quote-create-debit-amount.php
new file mode 100644
index 00000000..86e7a2bc
--- /dev/null
+++ b/snippets/php/quote/quote-create-debit-amount.php
@@ -0,0 +1,31 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Create quote
+$newQuote = $opClient->quote()->create(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $QUOTE_GRANT_ACCESS_TOKEN,
+ ],
+ [
+ 'method' => "ilp",
+ 'walletAddress' => $wallet->id,
+ 'receiver' => $INCOMING_PAYMENT_URL,
+ 'debitAmount' => [
+ 'assetCode' => $wallet->assetCode,
+ 'assetScale' => $wallet->assetScale,
+ 'value' => "130",
+ ],
+ ]
+);
+//@! end chunk 2
+
+//@! start chunk 3 | title=Output
+echo 'QUOTE_URL ' . $newQuote->id . PHP_EOL;
+echo 'QUOTE ' . print_r($newQuote, true) . PHP_EOL;
+//@! end chunk 3
diff --git a/snippets/php/quote/quote-create-receive-amount.php b/snippets/php/quote/quote-create-receive-amount.php
new file mode 100644
index 00000000..b933f155
--- /dev/null
+++ b/snippets/php/quote/quote-create-receive-amount.php
@@ -0,0 +1,30 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 1
+//@! start chunk 2 | title=Create quote
+$newQuote = $opClient->quote()->create(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $QUOTE_GRANT_ACCESS_TOKEN,
+ ],
+ [
+ 'method' => "ilp",
+ 'walletAddress' => $wallet->id,
+ 'receiver' => $INCOMING_PAYMENT_URL,
+ 'receiveAmount' => [
+ 'assetCode' => $wallet->assetCode,
+ 'assetScale' => $wallet->assetScale,
+ 'value' => "130",
+ ],
+ ]
+);
+//@! end chunk 2
+
+//@! start chunk 3 | title=Output
+echo 'QUOTE_URL ' . $newQuote->id . PHP_EOL;
+echo 'QUOTE ' . print_r($newQuote, true) . PHP_EOL;
+//@! end chunk 3
diff --git a/snippets/php/quote/quote-create.php b/snippets/php/quote/quote-create.php
new file mode 100644
index 00000000..18687afd
--- /dev/null
+++ b/snippets/php/quote/quote-create.php
@@ -0,0 +1,24 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+
+//@! start chunk 1 | title=Create quote
+$newQuote = $opClient->quote()->create(
+ [
+ 'url' => $wallet->resourceServer,
+ 'access_token' => $QUOTE_GRANT_ACCESS_TOKEN,
+ ],
+ [
+ 'method' => "ilp",
+ 'walletAddress' => $wallet->id,
+ 'receiver' => $INCOMING_PAYMENT_URL,
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Output
+echo 'QUOTE_URL ' . $newQuote->id . PHP_EOL;
+echo 'QUOTE ' . print_r($newQuote, true) . PHP_EOL;
+//@! end chunk 2
diff --git a/snippets/php/quote/quote-get.php b/snippets/php/quote/quote-get.php
new file mode 100644
index 00000000..e7df97d4
--- /dev/null
+++ b/snippets/php/quote/quote-get.php
@@ -0,0 +1,19 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+
+//@! start chunk 1 | title=Create quote
+$quote = $opClient->quote()->get(
+ [
+ 'access_token' => $QUOTE_GRANT_ACCESS_TOKEN,
+ 'url' => $QUOTE_URL
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Output
+echo 'QUOTE_URL ' . $quote->id . PHP_EOL;
+echo 'QUOTE ' . print_r($quote, true) . PHP_EOL;
+//@! end chunk 2
diff --git a/snippets/php/token/token-revoke.php b/snippets/php/token/token-revoke.php
new file mode 100644
index 00000000..d3e226d4
--- /dev/null
+++ b/snippets/php/token/token-revoke.php
@@ -0,0 +1,10 @@
+token()->revoke(
+ [
+ 'access_token' => $ACCESS_TOKEN,
+ 'url' => $TOKEN_MANAGE_URL
+ ]
+);
+//@! end chunk 1
diff --git a/snippets/php/token/token-rotate.php b/snippets/php/token/token-rotate.php
new file mode 100644
index 00000000..526ec080
--- /dev/null
+++ b/snippets/php/token/token-rotate.php
@@ -0,0 +1,15 @@
+token()->rotate(
+ [
+ 'access_token' => $ACCESS_TOKEN,
+ 'url' => $TOKEN_MANAGE_URL
+ ]
+);
+//@! end chunk 1
+
+//@! start chunk 2 | title=Output
+echo 'ACCESS_TOKEN: ' . $token->value . PHP_EOL;
+echo 'MANAGE_URL: ' . $token->manage . PHP_EOL;
+//@! end chunk 2
diff --git a/snippets/php/wallet-address/wallet-address-get-keys.php b/snippets/php/wallet-address/wallet-address-get-keys.php
new file mode 100644
index 00000000..49648fdc
--- /dev/null
+++ b/snippets/php/wallet-address/wallet-address-get-keys.php
@@ -0,0 +1,21 @@
+walletAddress()->getKeys([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 3
+
+//@! start chunk 4 | title=Output wallet address keys
+echo 'WALLET ADDRESS KEYS: ' . PHP_EOL . print_r($walletKeys, true);
+//@! end chunk 4
diff --git a/snippets/php/wallet-address/wallet-address-get.php b/snippets/php/wallet-address/wallet-address-get.php
new file mode 100644
index 00000000..adcd5209
--- /dev/null
+++ b/snippets/php/wallet-address/wallet-address-get.php
@@ -0,0 +1,21 @@
+walletAddress()->get([
+ 'url' => $config->getWalletAddressUrl()
+]);
+//@! end chunk 3
+
+//@! start chunk 4 | title=Output wallet address information
+echo 'WALLET ADDRESS: ' . PHP_EOL . print_r($wallet, true);
+//@! end chunk 4