Files
purchases-ios/Sources/Networking/HTTPClient
f14a56dbdf Add the networking layer for starting a hosted checkout (#7627)
* Add the networking layer for starting a hosted checkout

POST /rcbilling/v1/hosted-checkout creates the checkout session with the
payment provider and returns the page to present for it.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Send the Apple external purchase token id when starting a checkout

The endpoint ties the checkout session to the registered token, so the
token id is also part of the request's dedup key: two taps carrying
different tokens must never share one session.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Document what PostHostedCheckoutOperation is for

Co-authored-by: Cursor <cursoragent@cursor.com>

* Retry the hosted checkout request

Retries only ever fire on a 429, which the server rejects before creating
a session, so there is nothing to strand. Giving up instead costs the
customer the tap they are waiting on.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Name a case where no external purchase token applies

Co-authored-by: Cursor <cursoragent@cursor.com>

* Drop the comments on the hosted checkout path cases

Co-authored-by: Cursor <cursoragent@cursor.com>

* Generating new test snapshots (#7633)

* Generating new test snapshots (#7634)

* Generating new test snapshots (#7635)

* Generating new test snapshots (#7636)

* Generating new test snapshots (#7637)

* Generating new test snapshots (#7638)

* Generating new test snapshots (#7639)

* Generating new test snapshots (#7640)

* Generating new test snapshots (#7641)

* Cover the created status of a new checkout session

The endpoint answers 201, which is the status the flow actually reads.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Spell ID and URL the way the rest of the SDK does

The decoder converts from snake case, which yields Id and Url, so the
names have to be mapped rather than inferred.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Send the presented offering context when starting a checkout

A purchase made through the in-app sheet has to carry the same
attribution a StoreKit purchase from that paywall would, so placement,
targeting rule, workflow, step and paywall travel with it.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add snapshots for the presented offering context request

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
2026-09-07 16:42:50 +02:00
..