arazzo: 1.0.1
info:
title: Paystack Create Customer, Plan and Subscription
summary: Create a customer, define a billing plan, then subscribe the customer to the plan for recurring charges.
description: >-
The end-to-end recurring-billing setup. A customer profile is created, a
plan with an amount and interval is defined, and the customer is then
subscribed to that plan so Paystack handles the recurring debits and invoice
notifications. Every step spells out its request inline so the flow can be
read and executed without opening the underlying OpenAPI description.
version: 1.0.0
x-realizes-capability-ids:
- BC-420.10
- BC-4240
x-capability-derivation:
method: 'deterministic join: sourceDescriptions -> per-tag OpenAPI -> tag/capability edge. No classification at this step.'
min_confidence: 0.7
sources:
- capability_id: BC-420.10
capability_name: Customer Data Management
spec: paystack-customer-api-openapi.yml
confidence: 0.75
- capability_id: BC-4240
capability_name: Subscription Lifecycle Management
spec: paystack-subscription-api-openapi.yml
confidence: 0.75
model: Turbo EA Capabilities by Vincent Verdet — Turbo EA, https://github.com/vincentmakes/turbo-ea-capabilities, CC BY 4.0
sourceDescriptions:
- name: customerApi
url: ../openapi/paystack-customer-api-openapi.yml
type: openapi
- name: planApi
url: ../openapi/paystack-plan-api-openapi.yml
type: openapi
- name: subscriptionApi
url: ../openapi/paystack-subscription-api-openapi.yml
type: openapi
workflows:
- workflowId: create-customer-plan-and-subscription
summary: Stand up recurring billing by chaining customer, plan and subscription creation.
description: >-
Creates the customer, creates the plan, then subscribes the new customer to
the new plan using the codes returned by the prior steps.
inputs:
type: object
required:
- email
- planName
- amount
- interval
properties:
email:
type: string
description: Customer's email address.
first_name:
type: string
description: Customer's first name.
last_name:
type: string
description: Customer's last name.
planName:
type: string
description: Name of the billing plan.
amount:
type: integer
description: Plan amount in the smallest currency unit (kobo/pesewas/cents).
interval:
type: string
description: Billing interval (daily, weekly, monthly, biannually, annually).
currency:
type: string
description: Currency in which the plan amount is set (NGN, GHS, ZAR or USD).
steps:
- stepId: createCustomer
description: Create the customer who will be subscribed to the plan.
operationId: customer_create
requestBody:
contentType: application/json
payload:
email: $inputs.email
first_name: $inputs.first_name
last_name: $inputs.last_name
successCriteria:
- condition: $statusCode == 201
outputs:
customerCode: $response.body#/data/customer_code
- stepId: createPlan
description: Create the recurring plan with the supplied amount and interval.
operationId: plan_create
requestBody:
contentType: application/json
payload:
name: $inputs.planName
amount: $inputs.amount
interval: $inputs.interval
currency: $inputs.currency
successCriteria:
- condition: $statusCode == 201
outputs:
planCode: $response.body#/data/plan_code
- stepId: createSubscription
description: >-
Subscribe the newly created customer to the newly created plan so Paystack
manages the recurring charges.
operationId: subscription_create
requestBody:
contentType: application/json
payload:
customer: $steps.createCustomer.outputs.customerCode
plan: $steps.createPlan.outputs.planCode
successCriteria:
- condition: $statusCode == 201
outputs:
subscriptionCode: $response.body#/data/subscription_code
emailToken: $response.body#/data/email_token
outputs:
customerCode: $steps.createCustomer.outputs.customerCode
planCode: $steps.createPlan.outputs.planCode
subscriptionCode: $steps.createSubscription.outputs.subscriptionCode
emailToken: $steps.createSubscription.outputs.emailToken
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.