Note: The Angular SDK is written and intended to be used with Angular 17.To seamlessly integrate Appcharge’s Checkout Angular SDK into your application, follow these steps:
- Install the SDK: In your app, execute npm i appcharge-checkout-angular-sdkto install the Appcharge Checkout Angular SDK.
- Integrate the Library: Add AppchargeCheckoutModuleyourmodule.tsfile of the component.
appcharge-checkout and appcharge-init.
- appcharge-initcomponent needs to be rendered once at the top level of the web app (- app.component.ts) - this component will create a handshake with Appcharge’s Checkout solution, resulting in faster loading times for the checkout itself.
- appcharge-checkoutcomponent needs to be conditionally rendered once a user makes an action that requires payment (clicking on a bundle, for example). Start by rendering the- appcharge-initcomponent once the app loads:
HTML of your component, add the appcharge-checkout component, make sure the appcharge-checkout component is shown only once you have the checkoutUrl and sessionToken you fetched via a backend to backend API call.
- Appcharge’s checkout component allowed properties:
| Prop | Type | Mandatory | Params available | Description | 
|---|---|---|---|---|
| checkoutUrl | string | Yes | No | The checkoutUrl as provided by the “backend-to-backend” request | 
| sessionToken | string | Yes | No | The session token as provided by the “backend-to-backend” request | 
| checkoutToken | string | Yes | No | Unique public token for each game. Used to distinguish multiple game stores under the same domain | 
| locale | string | No | No | Defines the checkout language. Use displayName;ISOcodeif the display name differs from the ISO 639-1 code (e.g.,spanish;es), or just the ISO code if they match (e.g.,es) | 
| onClose | Function | No | Yes | The checkout popup has closed | 
| onOrderCreated | Function | No | Yes | Order has been created | 
| onOrderCompletedFailed | Function | No | Yes | The order has failed due to an internal error/publisher reward error | 
| onOrderCompletedSuccessfully | Function | No | Yes | An order has updated with the publisher and confirmation was received | 
| onPaymentIntentFailed | Function | No | Yes | The player has clicked on ‘Pay’ and the payment failed | 
| onPaymentIntentSuccess | Function | No | Yes | The player has clicked on ‘Pay’ and the payment has been charged successfully | 
undefined.
| Name | Type | Description | 
|---|---|---|
| orderId | string | Unique identifier for the order. | 
| orderExternalId | string | External identifier for the order. | 
| date | string | Date of the order. | 
| sessionId | string | Identifier for the session associated with the order. | 
| purchaseInvoiceId | string | Identifier for the associated purchase invoice. | 
| appChargePaymentId | string | Identifier for the payment associated with the order. | 
| bundleName | string | Name of the bundle associated with the order. | 
| bundleId | string | Identifier for the bundle. | 
| bundleSKU | string | Stock Keeping Unit (SKU) for the bundle. | 
| products | Product[] | Array of products included in the order. | 
| totalSum | number | Total sum of the order. | 
| totalSumCurrency | string | Currency of the total sum. | 
| paymentMethodName | string | Name of the payment method used for the order. | 
| userId | string | (Optional) Identifier for the user placing the order. | 
| userCountry | string | (Optional) Country associated with the user. | 
| reason | string | (Optional) Reason for the order or additional notes. | 
- Price points:
- environment (string, mandatory): This parameter specifies the environment and can be either sandbox or prod.
- domain (string, optional): This parameter is the domain of your store. If not provided, the function will use the current domain as the default.
