New customer checkout

This API takes minimal offering configuration and optionally payment method information to provision a contract.

POST/api/selfService/checkout

operation: provisionContract

Request body

type CreateOfferingItemRequest = {
  productId: string;
	quantity: number;
}

type CreateOfferingRequest = {
  offeringId: string;
  rateId: string;
}

type PaymentConfiguration = {
  paymentToken: string;
	paymentGatewayId: string;
}

type NewCustomerCheckoutRequest = {
  accountId: string;
  currency: string;
  offerings: CreateOfferingRequest[];
	startDate: Iso8601DateString;
  endDate?: Iso8601DateString;
	payment?: PaymentConfiguration;
}

Response body

Errors

Error descriptionError code
Account ID nonexistentINVALID_ACCOUNT
Request contains no offeringsEMPTY_OFFERINGS
Request contains nonexistent offeringsINVALID_OFFERINGS
Request contains nonexistent ratesINVALID_RATES
Specified rates belong to other accountsACCOUNT_RATE_MISMATCH
Specified end date of contract is greater than the start dateINVALID_CONTRACT_END_DATE
Pricing of offerings failed due to validation error(s)PRICE_OFFERINGS_FAILED

Success

type NewContractCheckoutResponse = {
  accountId: string;
  contractId: string;
  billGroupId: string;
  paymentMethod?: {
    id: string;
    type: string;
		externalId: string;
  };
}
  • paymentMethod.id would be a MonetizeNow ID for your optionally supplied payment method
  • paymentMethod.externalId would be the ID of the payment method in the payment gateway (e.g. Stripe) you've configured