Behaviour for a store adapter — Apple, Google, Steam, or a host's own.
A host swaps one out through config:
config :gamend_core, :payment_provider_adapters, apple: MyGame.AppleStubThat seam existed before this behaviour did, which meant the contract was
whatever Gamend.Payments happened to call, discoverable only by reading it.
The symptom was function_exported?(module, :config_status, 0) guarding
every call to an optional callback: a runtime probe standing in for a
declaration.
Required
validate_purchase/2 is the one every adapter implements: given the
attributes a client submitted, confirm with the store that the purchase is
real, and answer with the normalised fields ("environment",
"provider_transaction_id", and whatever else the provider knows).
Optional
The rest are per-provider. Steam has a two-step init/finalize flow that the
others do not; Apple verifies signed notifications where Google verifies a
bearer token on the webhook. Declare only what your store actually does —
Gamend.Payments checks before calling, and now checks against this list.
Summary
Payments hooks
Verifies a purchase with the store and returns its normalised fields.
Callbacks
Whether this adapter has the credentials it needs, for the admin console.
Completes a checkout started by init_transaction/3.
Starts a provider-hosted checkout (Steam's init/finalize flow).
Reads back one transaction's current state from the store.
Verifies a signed store notification (Apple's App Store Server V2).
Verifies a webhook's authenticity from its authorization header.
Payments hooks
Types
Callbacks
Whether this adapter has the credentials it needs, for the admin console.
Assumed configured when not implemented.
Completes a checkout started by init_transaction/3.
Starts a provider-hosted checkout (Steam's init/finalize flow).
Reads back one transaction's current state from the store.
Verifies a signed store notification (Apple's App Store Server V2).
Verifies a webhook's authenticity from its authorization header.