Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions docs/src/content/docs/guides/accept-otp-online-purchase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ Call the <Badge text="GET" variant="note" /> [Get Wallet Address API](/apis/wall
let retailer_wallet_address = client.wallet_address().get("https://happylifebank.example.com/retailer").await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$customerWalletAddress = $client->walletAddress()->get([
'url' => 'https://cloudninebank.example.com/customer'
]);
$retailerWalletAddress = $client->walletAddress()->get([
'url' => 'https://happylifebank.example.com/retailer'
]);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -132,6 +142,25 @@ let retailer_incoming_payment_grant = client

````
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap

$retailerIncomingPaymentGrant = $client->grant()->request(
[
'url' => $retailerWalletAddress->authServer
],
[
'access_token' => [
'access' => [
[
'type' => 'incoming-payment',
'actions' => ['read', 'complete', 'create', 'list']
]
]
]
]
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -209,6 +238,24 @@ Some(&retailer_incoming_payment_grant.access_token.value),

````
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$retailerIncomingPayment = $client->incomingPayment()->create(
[
'url' => $retailerWalletAddress->resourceServer,
'accessToken' => $retailerIncomingPaymentGrant->access_token->value
],
[
'walletAddress' => $retailerWalletAddress->id,
'incomingAmount' => [
'value' => '140000',
'assetCode' => 'MXN',
'assetScale' => 2
]
]
);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -283,6 +330,25 @@ let customer_quote_grant = client

````
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$customerQuoteGrant = $client->grant()->request(
[
'url' => $customerWalletAddress->authServer
],
[
'access_token' => [
'access' => [
[
'type' => 'quote',
'actions' => ['create']
]
]
]
]
);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -358,6 +424,21 @@ Some(&customer_quote_grant.access_token.value),

````
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$customerQuote = $client->quote()->create(
[
'url' => $customerWalletAddress->resourceServer,
'accessToken' => $customerQuoteGrant->access_token->value
],
[
'method' => 'ilp',
'walletAddress' => $customerWalletAddress->id,
'receiver' => $retailerIncomingPayment->id
]
);
```
</TabItem>
</Tabs>

The response returns a `receiveAmount`, a `debitAmount`, and other required information.
Expand Down Expand Up @@ -467,6 +548,41 @@ Outgoing payments require an interactive grant. This type of grant will obtain t
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```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'
]
]
]
);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -546,6 +662,19 @@ Some(&continue_field.access_token.value),

````
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$customerOutgoingPaymentGrant = $client->grant()->continue(
[
'url' => $pendingCustomerOutgoingPaymentGrant->continue->uri,
'accessToken' => $pendingCustomerOutgoingPaymentGrant->continue->access_token->value
],
[
'interact_ref' => $interactRef
]
);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -617,6 +746,20 @@ Use the access token returned in Step 9 to call the <Badge text="POST" variant="
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$customerOutgoingPayment = $client->outgoingPayment()->create(
[
'url' => $customerWalletAddress->resourceServer,
'accessToken' => $customerOutgoingPaymentGrant->access_token->value
],
[
'walletAddress' => $customerWalletAddress->id,
'quoteId' => $customerQuote->id
]
);
```
</TabItem>
</Tabs>

If the request fails because of an expired quote, [request a new quote](#5-request-the-creation-of-a-quote-resource) and try again.
Expand Down
136 changes: 136 additions & 0 deletions docs/src/content/docs/guides/onetime-remittance-fixed-debit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ Call the <Badge text="GET" variant="note" /> [Get Wallet Address API](/apis/wall
let recipient_wallet_address = client.wallet_address().get("https://happylifebank.example.com/recipient").await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$senderWalletAddress = $client->walletAddress()->get([
'url' => 'https://cloudninebank.example.com/sender'
]);
$recipientWalletAddress = $client->walletAddress()->get([
'url' => 'https://happylifebank.example.com/recipient'
]);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -151,6 +161,22 @@ This call obtains an access token that allows your app to request that an incomi
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$recipientIncomingPaymentGrant = $client->grant()->request([
'url' => $recipientWalletAddress->authServer
], [
'access_token' => [
'access' => [
[
'type' => 'incoming-payment',
'actions' => ['create']
]
]
]
]);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -219,6 +245,16 @@ This call requests an incoming payment resource be created on the recipient's wa
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$recipientIncomingPayment = $client->incomingPayment()->create([
'url' => $recipientWalletAddress->resourceServer,
'accessToken' => $recipientIncomingPaymentGrant->access_token->value
], [
'walletAddress' => $recipientWalletAddress->id
]);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -287,6 +323,24 @@ This call obtains an access token that allows your app to request that a quote r
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$senderQuoteGrant = $client->grant()->request(
[
'url' => $senderWalletAddress->authServer
],
[
'access_token' => [
'access' => [
[
'type' => 'quote',
'actions' => ['create']
]
]
]
]);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -368,6 +422,26 @@ The `debitAmount` specifies that the sender will pay exactly $100 USD, and the r
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```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
]
]
);
```
</TabItem>
</Tabs>

The response returns a `receiveAmount`, a `debitAmount`, and other required information.
Expand Down Expand Up @@ -500,6 +574,41 @@ let pending_sender_outgoing_payment_grant = client

````
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```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'
]
]
]
);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -578,6 +687,19 @@ Include the `interact_ref` returned in the redirect URI's query parameters.
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$senderOutgoingPaymentGrant = $client->grant()->continue(
[
'url' => $pendingSenderOutgoingPaymentGrant->continue->uri,
'accessToken' => $pendingSenderOutgoingPaymentGrant->continue->access_token->value
],
[
'interact_ref' => $interactRef
]
);
```
</TabItem>
</Tabs>

<details>
Expand Down Expand Up @@ -649,6 +771,20 @@ Use the access token returned in Step 9 to call the <Badge text="POST" variant="
.await?;
```
</TabItem>
<TabItem label="PHP" icon='seti:php'>
```php wrap
$senderOutgoingPayment = $client->outgoingPayment()->create(
[
'url' => $senderWalletAddress->resourceServer,
'accessToken' => $senderOutgoingPaymentGrant->access_token->value
],
[
'walletAddress' => $senderWalletAddress->id,
'quoteId' => $senderQuote->id
]
);
```
</TabItem>
</Tabs>

If the request fails because of an expired quote, [request a new quote](#5-request-the-creation-of-a-quote-resource) and try again.
Expand Down
Loading