Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: SpawnJSObject
Source: JSObjects/PaymentManager.cs
MDN Reference: PaymentManager on MDN
The PaymentManager interface of the Payment Handler API is used to manage various aspects of payment app functionality. It is accessed via the ServiceWorkerRegistration.paymentManager property. https://developer.mozilla.org/en-US/docs/Web/API/PaymentManager
| Property | Type | Access | Description |
|---|---|---|---|
UserHint |
string |
get | Provides a hint for the browser to display along with the payment app's name and icon in the Payment Handler UI. |
| Method | Return Type | Description |
|---|---|---|
EnableDelegations(IEnumerable<string> delegations) |
Task |
Delegates responsibility for providing various parts of the required payment information to the payment app rather than collecting it from the browser (for example, via autofill). An array containing one or more enumerated values that specify the payment information you want to delegate to the payment app. Possible values can be: payerEmail - The payment app will provide the payer's email whenever it is needed. payerName - The payment app will provide the payer's name whenever it is needed. payerPhone - The payment app will provide the payer's phone number whenever it is needed. shippingAddress - The payment app will provide the shipping address whenever it is needed. |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<PaymentManager>(...)or constructornew PaymentManager(...)
navigator.serviceWorker.register("serviceworker.js").then((registration) => {
registration.paymentManager.userHint = "Card number should be 16 digits";
registration.paymentManager
.enableDelegations(["shippingAddress", "payerName"])
.then(() => {
// …
});
// …
});