feat(medusa-js): Add payment and payment collections clients (#2608)
This commit is contained in:
@@ -66,3 +66,4 @@ export * from "./routes/store/returns"
|
||||
export * from "./routes/store/shipping-options"
|
||||
export * from "./routes/store/swaps"
|
||||
export * from "./routes/store/variants"
|
||||
export * from "./routes/store/payment-collections"
|
||||
|
||||
+27
-1
@@ -45,7 +45,33 @@ import { PaymentCollectionService } from "../../../../services"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.paymentCollections.sessions(payment_id, payload)
|
||||
*
|
||||
* // Total amount = 10000
|
||||
*
|
||||
* // Adding two new sessions
|
||||
* medusa.paymentCollections.manageSessions(payment_id, [
|
||||
* {
|
||||
* provider_id: "stripe",
|
||||
* customer_id: "cus_123",
|
||||
* amount: 5000,
|
||||
* },
|
||||
* {
|
||||
* provider_id: "manual",
|
||||
* customer_id: "cus_123",
|
||||
* amount: 5000,
|
||||
* },
|
||||
* ])
|
||||
* .then(({ payment_collection }) => {
|
||||
* console.log(payment_collection.id);
|
||||
* });
|
||||
*
|
||||
* // Updating one session and removing the other
|
||||
* medusa.paymentCollections.manageSessions(payment_id, {
|
||||
* provider_id: "stripe",
|
||||
* customer_id: "cus_123",
|
||||
* amount: 10000,
|
||||
* session_id: "ps_123456"
|
||||
* })
|
||||
* .then(({ payment_collection }) => {
|
||||
* console.log(payment_collection.id);
|
||||
* });
|
||||
|
||||
Reference in New Issue
Block a user