diff --git a/.changeset/purchase-return-url.md b/.changeset/purchase-return-url.md new file mode 100644 index 000000000..d3536f42f --- /dev/null +++ b/.changeset/purchase-return-url.md @@ -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. diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index d90f39feb..782cc9084 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -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 diff --git a/packages/core/README.md b/packages/core/README.md index dfcd70a34..aba0b312c 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -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 diff --git a/packages/core/src/types/transaction.ts b/packages/core/src/types/transaction.ts index 2a89eb166..05c58dd33 100644 --- a/packages/core/src/types/transaction.ts +++ b/packages/core/src/types/transaction.ts @@ -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; @@ -80,6 +82,7 @@ export interface TransactionCostResponse { } export interface TransactionResponse { + returnUrl?: string | null; id: string; organizationId: string; serviceName: string;