Calculate a plan

Use this interface to calculate a new recycling plan

Calculate a plan

POST /svc/payment/api/v1/openapi/recurring_payments/plan/calculate

Use this interface to calculate a new recycling plan

  • If there are identical reference_numbers when creating a recycling plan, you will be informed: “plan has been created”
  • Multiple recurring_cycle can be created with this API in succession
  • The next_billing_amount of the first recurring_cycles is the total amount of the order to be generated, with discount and proration deduction alrerady included.

Request

Header Parameters

x-appid string

Example:{{appid}}

  • application/json

Body

plan objectrequired

name stringrequired

This is name of the recurring plan (ex: Plan A)

reference_number string

This field is to generate the reference number for the connecting orders created by the recurring plan

  • Every new order created under this recurring plan will have the same “reference number” with incremental suffix

customer_uuid stringrequired

default_collection_method stringrequired

Single option choice: [charge_automatically] - automatically charge the customer provided card details

payment_retry_count numberrequired

This is to set the limit how many attempts to be executed. Once the count limit has reached, then the system will change the status to recurring_cycles.state = uncollectible

payment_retry_day_period numberrequired

Once the initial payment request attempt is unsuccessful, the system will wait until the next given period data specified in payment_retry_day_period (ex: 1 day). Once the specified day period has reached, then the system will pose another charge attempt to the recurring order.

grace_period number

This field is to count the day period that after the final attempt of payment charge is unsuccessful, then how many more days until the system will void the recurring_order record. Then change the status to recurring_cycles.state = uncollectible. If grace_period = NULL , then the system will never void the recurring_orders record

callback_url string

redirect_url string

timeout object

timer integerrequired

url string

note string

This is transferred to return the note for all related recurring orders

description string

Any description to remark about this record

recurring_cycles object[]required

Array [

billing_count numberrequired

This is to count how long will the recurring cycle run for. If data is null, then consider this recurring_cycles record will run forerver.

recurring_billing_config stringrequired

This is for the system to know the billing date of a cycle, once the cycle has started

recurring_items object[]required

Array [

quantity numberrequired

recurring_item_id stringrequired

]

discount_amount number

discount_type string

description string

]

Responses

  • 200

Response Headers

  • application/json

  • Schema

  • Example (auto)

Schema

code integerrequired

message stringrequired

data objectrequired

plan objectrequired

id stringrequired

name string

reference_number string

default_payment_token string

default_collection_method string

payment_retry_count number

payment_retry_day_period number

grace_period numbernullable

credit number

redirect_url string

note string

timeout object

timer integerrequired

url string

description stringnullable

created_at stringrequired

updated_at stringrequired

deleted_at stringnullable

recurring_cycles object[]required

Array [

id string

state stringrequired

recurring_plan_id stringrequired

billing_count integer

billing_count_created integerrequired

recurring_billing_config objectrequired

id stringrequired

billing_interval stringrequired

billing_type string

billing_month integer

billing_day_of_month integer

billing_proration_enabled booleanrequired

description string

created_at string

updated_at string

deleted_at stringnullable

recurring_items object[]required

Array [

id stringrequired

label string

price numberrequired

quantity integerrequired

currency stringrequired

reference_id string

description string

created_at stringrequired

updated_at string

deleted_at stringnullable

]

billing_amount number

discount_amount number

discount_type string

previous_cycle stringnullable

next_cycle stringnullable

estimated_start_date string

start_date stringnullable

estimated_end_date stringnullable

end_date stringnullable

next_execute_time stringnullable

description stringnullable

created_at stringrequired

updated_at stringrequired

deleted_at stringnullable

]

customer object

name string

email string

phone string

reference_number stringrequired

default_payment_method string

uuid stringrequired

current_order object

amount number

paid_total number

currency string

order_number string

reference_number string

state string

correspondence_state string

auth_code string

default_payment_token string

default_collection_method string

note string

redirect_url string

timeout object

timer string

url string

current_payment_link string

{ "code": 0, "message": "string", "data": { "plan": { "id": "string", "name": "string", "reference_number": "string", "default_payment_token": "string", "default_collection_method": "string", "payment_retry_count": 0, "payment_retry_day_period": 0, "grace_period": 0, "credit": 0, "redirect_url": "string", "note": "string", "timeout": { "timer": 0, "url": "string" }, "description": "string", "created_at": "string", "updated_at": "string", "deleted_at": "string", "recurring_cycles": [\ {\ "id": "string",\ "state": "string",\ "recurring_plan_id": "string",\ "billing_count": 0,\ "billing_count_created": 0,\ "recurring_billing_config": {\ "id": "string",\ "billing_interval": "string",\ "billing_type": "string",\ "billing_month": 0,\ "billing_day_of_month": 0,\ "billing_proration_enabled": true,\ "description": "string",\ "created_at": "string",\ "updated_at": "string",\ "deleted_at": "string"\ },\ "recurring_items": [\ {\ "id": "string",\ "label": "string",\ "price": 0,\ "quantity": 0,\ "currency": "string",\ "reference_id": "string",\ "description": "string",\ "created_at": "string",\ "updated_at": "string",\ "deleted_at": "string"\ }\ ],\ "billing_amount": 0,\ "discount_amount": 0,\ "discount_type": "string",\ "previous_cycle": "string",\ "next_cycle": "string",\ "estimated_start_date": "string",\ "start_date": "string",\ "estimated_end_date": "string",\ "end_date": "string",\ "next_execute_time": "string",\ "description": "string",\ "created_at": "string",\ "updated_at": "string",\ "deleted_at ": "string"\ }\ ], "customer": { "name": "string", "email": "string", "phone": "string", "reference_number": "string", "default_payment_method": "string", "uuid": "string" }, "current_order": { "amount": 0, "paid_total": 0, "currency": "string", "order_number": "string", "reference_number": "string", "state": "string", "correspondence_state": "string", "auth_code": "string", "default_payment_token": "string", "default_collection_method": "string", "note": "string", "redirect_url": "string", "timeout": { "timer": "string", "url": "string" } }, "current_payment_link": "string" } } }
  • csharp

  • curl

  • dart

  • go

  • http

  • java

  • javascript

  • kotlin

  • c

  • nodejs

  • objective-c

  • ocaml

  • php

  • powershell

  • python

  • r

  • ruby

  • rust

  • shell

  • swift

  • HTTPCLIENT

  • RESTSHARP

var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://developer.wonder.today/svc/payment/api/v1/openapi/recurring_payments/plan/calculate"); request.Headers.Add("Accept", "application/json"); var content = new StringContent("{\n \"plan\": {\n \"name\": \"string\",\n \"reference_number\": \"string\",\n \"customer_uuid\": \"string\",\n \"default_collection_method\": \"string\",\n \"payment_retry_count\": 0,\n \"payment_retry_day_period\": 0,\n \"grace_period\": 0,\n \"callback_url\": \"string\",\n \"redirect_url\": \"string\",\n \"timeout\": {\n \"timer\": 0,\n \"url\": \"string\"\n },\n \"note\": \"string\",\n \"description\": \"string\",\n \"recurring_cycles\": [\n {\n \"billing_count\": 0,\n \"recurring_billing_config\": \"string\",\n \"recurring_items\": [\n {\n \"quantity\": 0,\n \"recurring_item_id\": \"string\"\n }\n ],\n \"discount_amount\": 0,\n \"discount_type\": \"string\",\n \"description\": \"string\"\n }\n ]\n }\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());

Request Collapse all

Parameters

Show optional parameters

x-appid — header

Body

{ "plan": { "name": "string", "reference_number": "string", "customer_uuid": "string", "default_collection_method": "string", "payment_retry_count": 0, "payment_retry_day_period": 0, "grace_period": 0, "callback_url": "string", "redirect_url": "string", "timeout": { "timer": 0, "url": "string" }, "note": "string", "description": "string", "recurring_cycles": [\ {\ "billing_count": 0,\ "recurring_billing_config": "string",\ "recurring_items": [\ {\ "quantity": 0,\ "recurring_item_id": "string"\ }\ ],\ "discount_amount": 0,\ "discount_type": "string",\ "description": "string"\ }\ ] } }