Orders can be created in two ways.
Superadmin and and can create manual order POST /orders
payload
form data
name: Hello Service
budget: 100
client: 665e82153fb3434863879c5c
service: 67c6aaf74693a57fd14bc1e9
quantity: 1
notes:
currency: USD
paymentType: oneTime
packageName: Primary
packageId: 67c6aaf74693a57fd14bc1ed
assignedProjectManagers: []
2. Client can pay and create order
a. With Stripe, Onetime service
/orders/catalog/create?userType=guest
payload
{
"firstName": "atik",
"lastName": "client",
"email": "atik-client@yopmail.com",
"quantity": 1,
"country": "",
"state": "",
"city": "",
"postal_code": "",
"line1": "",
"packageName": "Primary",
"packageId": "67c6aaf74693a57fd14bc1ed",
"mode": "payment",
"integrationId": "6541d78d9b8ea5c58a2bb290",
"serviceId": "67c6aaf74693a57fd14bc1e9",
"paymentType": "oneTime",
"userType": "guest"
}
Response:
{
"success": true,
"message": "Order created successfully",
"orderId": "67c6ae124693a57fd14be094",
"memberId": "665e82153fb3434863879c5c",
"upsellIds": [],
"paymentResponse": {
"clientSecret": "pi_3Qyq47CHBFKUa0BX1SpEhAUL_secret_0qJGybTNGC97hahT7kujTtXXy"
}
}
You can use this clientSecret to render stripe ui to take client payment
b. Stripe subscription payment
POST
orders/catalog/create?userType=guest
payload
{
"firstName": "atik",
"lastName": "client",
"email": "atik-client@yopmail.com",
"quantity": 1,
"country": "",
"state": "",
"city": "",
"postal_code": "",
"line1": "",
"packageName": "Primary",
"packageId": "679afd4d2b2aa1c9d6626822",
"mode": "payment",
"integrationId": "6541d78d9b8ea5c58a2bb290",
"serviceId": "679afd4c2b2aa1c9d6626820",
"paymentType": "subscription",
"stripeCardToken": "tok_1Qyq7DCHBFKUa0BXPEPW2R2f",
"userType": "guest"
}
Note: for subscription orders, you need to pass a stripe card token.
Paypal onetime
{
"firstName": "atik",
"lastName": "client",
"email": "atik-client@yopmail.com",
"quantity": 1,
"country": "",
"state": "",
"city": "",
"postal_code": "",
"line1": "",
"packageName": "Primary",
"packageId": "67bea21d4114be2caabe17cc",
"mode": "payment",
"integrationId": "663b32ab633dfc9c90423e4e",
"serviceId": "67bea21d4114be2caabe17ca",
"paymentType": "oneTime",
"userType": "guest"
}
now take payment with paypal. follow paypal docs for this step.
after payment is done
POST
/orders/create-paypal-order
payload
{projectId: "67c6af6f4693a57fd14c1cb5"}
response
{
"success": true,
"message": "Paypal order created",
"data": {
"paypalOrderId": "60U57979FL793562E"
}
}
then
/orders/capture-paypal-order
payload
{paypalOrderId: "60U57979FL793562E"}
response
{"success":true,"message":"Paypal order captured"}
paypal subscription
orders/catalog/create?userType=guest
payload
{
"firstName": "atik",
"lastName": "client",
"email": "atik-client@yopmail.com",
"quantity": 1,
"country": "",
"state": "",
"city": "",
"postal_code": "",
"line1": "",
"packageName": "Primary",
"packageId": "679afd4d2b2aa1c9d6626822",
"mode": "payment",
"integrationId": "663b32ab633dfc9c90423e4e",
"serviceId": "679afd4c2b2aa1c9d6626820",
"paymentType": "subscription",
"userType": "guest"
}
response
{
"success": true,
"message": "Order created successfully",
"orderId": "67c6b09c4693a57fd14c218f",
"memberId": "665e82153fb3434863879c5c",
"upsellIds": [],
"paymentResponse": {
"success": true,
"paypalPlanId": "P-73D137428C019302RM7DLBHQ"
}
}
then render paypal subscription payment ui. you’ll get paypalSubscriptionId from that.
then
POST /orders/approve-paypal-subscription
payload
{"projectId":"67c6b09c4693a57fd14c218f","paypalSubscriptionId":"I-TDGRDAD7WBN5"}
response
{"success":true,"message":"Paypal subscription approved"}