Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .changeset/purchase-return-url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sapiom/core": minor
---

Add optional transaction returnUrl types for returning to an integrator after hosted approval and card confirmation. Requires the corresponding backend deployment and a registered return destination.
4 changes: 4 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @sapiom/core

## Unreleased

- Add optional transaction `returnUrl` for hosted purchase approval/card-confirmation return navigation. Destinations must be registered by the organization. Requires the corresponding backend deployment and package publication.

## 0.5.0

### Minor Changes
Expand Down
12 changes: 12 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ await client.transactions.create({
})
```

##### Hosted purchase return navigation

Pass `returnUrl` to `client.transactions.create(...)` to offer a return to your app after
hosted approval and any required card confirmation. It may include your own opaque conversation
reference, for example `https://your-app.example/conversations/123?state=opaque-reference`.
Register HTTPS origins in organization metadata `paymentReturnOrigins`, or native app schemes
(without the colon) in `paymentReturnSchemes`, through the organization PATCH API with `org.write`.
The destination is stored per purchase, survives sign-in and revisions, and is opened only when
the user clicks the return link. Sapiom adds no result parameters. Omission preserves the existing
completion screen; read the transaction/checkout status before reporting payment success.
Requires the corresponding backend deployment; native-link handling depends on the target device.

##### transactions.get()

```typescript
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/types/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface TransactionCostInput {
}

export interface CreateTransactionRequest {
/** Return after hosted approval/card confirmation, using a registered organization destination. */
returnUrl?: string;
requestFacts?: {
source: string;
version: string;
Expand Down Expand Up @@ -80,6 +82,7 @@ export interface TransactionCostResponse {
}

export interface TransactionResponse {
returnUrl?: string | null;
id: string;
organizationId: string;
serviceName: string;
Expand Down
Loading