Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::events::IapClient Class Referenceabstract

Cross-platform in-app purchase surface. More...

#include <in_app_purchase.hpp>

Public Member Functions

virtual ~IapClient ()=default
virtual bool is_available () const =0
 Returns true when a real IAP backend is wired up on this build.
virtual std::string backend_id () const =0
 Short identifier of the active backend.
virtual void request_products (const std::vector< std::string > &skus, ProductLookupCallback callback)=0
 Ask the backend for metadata + localized pricing of the given SKUs.
virtual void purchase (const std::string &sku, PurchaseCallback callback)=0
 Initiate a purchase flow for sku.
virtual void restore (RestoreCallback callback)=0
 Ask the backend to re-issue every previously-completed purchase.
virtual void set_observer (PurchaseObserver observer)=0
 Register a callback that fires for any backend-resolved purchase (including out-of-band transactions and subscription renewals).
virtual bool finish_transaction (const std::string &transaction_id)=0
 Acknowledge / finish a purchase so the backend stops re-delivering it.

Static Public Member Functions

static IapClient & instance ()

Protected Member Functions

 IapClient ()=default
 IapClient (const IapClient &)=delete
IapClient & operator= (const IapClient &)=delete

Detailed Description

Cross-platform in-app purchase surface.

Use the singleton via IapClient::instance(). The implementation is thread-safe: any thread may invoke any method. The built-in stub invokes callbacks synchronously; host backends may dispatch on their own platform queue, so callers must hop back to their UI thread before touching view state.

Constructor & Destructor Documentation

◆ ~IapClient()

virtual pulp::events::IapClient::~IapClient ( )
virtualdefault

◆ IapClient() [1/2]

pulp::events::IapClient::IapClient ( )
protecteddefault

◆ IapClient() [2/2]

pulp::events::IapClient::IapClient ( const IapClient & )
protecteddelete

Member Function Documentation

◆ backend_id()

virtual std::string pulp::events::IapClient::backend_id ( ) const
pure virtual

Short identifier of the active backend.

Pulp's built-in backend reports "none"; tests use "test-mock"; host backends should choose a stable diagnostic id such as "storekit2", "winrt-store", or "play-billing".

◆ finish_transaction()

virtual bool pulp::events::IapClient::finish_transaction ( const std::string & transaction_id)
pure virtual

Acknowledge / finish a purchase so the backend stops re-delivering it.

Required by StoreKit and Play Billing once entitlement has been granted. Returns true if the backend recognized the transaction id.

◆ instance()

IapClient & pulp::events::IapClient::instance ( )
static

◆ is_available()

virtual bool pulp::events::IapClient::is_available ( ) const
pure virtual

Returns true when a real IAP backend is wired up on this build.

On false, every method reports Unavailable and never charges.

◆ operator=()

IapClient & pulp::events::IapClient::operator= ( const IapClient & )
protecteddelete

◆ purchase()

virtual void pulp::events::IapClient::purchase ( const std::string & sku,
PurchaseCallback callback )
pure virtual

Initiate a purchase flow for sku.

The callback fires once the transaction resolves; the same Purchase is also reported to the observer (if one is installed) so receipt-validation code can live in a single place regardless of which entry point started the flow.

◆ request_products()

virtual void pulp::events::IapClient::request_products ( const std::vector< std::string > & skus,
ProductLookupCallback callback )
pure virtual

Ask the backend for metadata + localized pricing of the given SKUs.

The callback fires once the backend has resolved the request (or synchronously on the stub when no backend is wired).

◆ restore()

virtual void pulp::events::IapClient::restore ( RestoreCallback callback)
pure virtual

Ask the backend to re-issue every previously-completed purchase.

Used on a fresh install / new device to recover entitlements.

◆ set_observer()

virtual void pulp::events::IapClient::set_observer ( PurchaseObserver observer)
pure virtual

Register a callback that fires for any backend-resolved purchase (including out-of-band transactions and subscription renewals).

Pass {} to clear. Single-slot — last writer wins, matching the PushNotifications::set_handler contract.


The documentation for this class was generated from the following file: