appcharge-checkout-angular-sdk
v3.0.0
Published
Welcome to Appcharge's Checkout Solution, run it in a few easy steps
Downloads
95
Readme
appcharge-checkout-angular-sdk
Welcome to Appcharge's Checkout Solution, run it in a few easy steps
Getting Started
Installation
Install the SDK as dependency in your project.
# NPM npm install appcharge-checkout-angular-sdkUsage
To use the SDK in your Angular application, First, Import AppchargeCheckoutAngularSdkModule module in root:
import { AppchargeCheckoutModule } from 'appcharge-checkout-angular-sdk'; @NgModule({ declarations: [ AppComponent ], imports: [ ...., AppchargeCheckoutModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }Then setup your components and the service as below :
import { AppchargeCheckoutService } from 'appcharge-checkout-angular-sdk'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], providers: [ AppchargeCheckoutService ] }) export class AppComponent { constructor(private appchargeSdkLib: AppchargeCheckoutService) {} }AppchargeInitComponent
The
AppchargeInitComponentcomponent needs to be rendered once - this component will create a handshake with Appcharge's Checkout solution, resulting in faster loading times for the checkout itself.Example:
<appcharge-init [environment]="env" [domain]="domain"></appcharge-init>environment (string, optional): The environment for Appcharge Checkout. Use 'sandbox' for testing and 'prod' for the production environment. Defaults to 'sandbox'.
domain (string, optional): The domain for which Appcharge Checkout is being initialized. Defaults to the current window's host.
AppchargeCheckoutComponent
The
AppchargeCheckoutComponentcomponent needs to be conditionally rendered once a user makes an action that requires payment (clicking on a bundle, for example).<appcharge-checkout *ngIf="checkoutUrl && sessionToken" [checkoutUrl]="checkoutUrl" [sessionToken]="sessionToken"></appcharge-checkout>| Param | Type | Mandatory | | ------------------------------ | --------- | --------- | |
checkoutUrl| string | YES | |sessionToken| string | YES | |onOpen| function | no | |onClose| function | no | |onInitialLoad| function | no | |onOrderCreated| function | no | |onPaymentIntentFailed| function | no | |onOrderCompletedFailed| function | no | |onPaymentIntentSuccess| function | no | |onOrderCompletedSuccessfully| function | no |Functions.
Get Price Points
Retrieve available price points as configured on appcharge's dashboard.
this.appchargeService.getPricePoints();environment (string, optional): The environment for Appcharge Checkout. Use 'sandbox' for testing and 'prod' for the production environment. Uses 'sandbox' as default.
domain (string, optional): The domain for which Appcharge Checkout is being initialized. Defaults to the current window's host.
