chore(docs): Generated API reference (#2788)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
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.orders.claimOrders({
|
||||
display_ids,
|
||||
})
|
||||
.then(() => {
|
||||
// successful
|
||||
})
|
||||
.catch(() => {
|
||||
// an error occurred
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
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.orders.confirmRequest(
|
||||
token,
|
||||
)
|
||||
.then(() => {
|
||||
// successful
|
||||
})
|
||||
.catch(() => {
|
||||
// an error occurred
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
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.retrieve(paymentCollectionId)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id)
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
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
|
||||
// Total amount = 10000
|
||||
// Adding a payment session
|
||||
medusa.paymentCollections.managePaymentSession(payment_id, { provider_id: "stripe" })
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
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
|
||||
// Total amount = 10000
|
||||
// Adding two new sessions
|
||||
medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [
|
||||
{
|
||||
provider_id: "stripe",
|
||||
amount: 5000,
|
||||
},
|
||||
{
|
||||
provider_id: "manual",
|
||||
amount: 5000,
|
||||
},
|
||||
])
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
// Updating one session and removing the other
|
||||
medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [
|
||||
{
|
||||
provider_id: "stripe",
|
||||
amount: 10000,
|
||||
session_id: "ps_123456"
|
||||
},
|
||||
])
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
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.authorize(payment_id)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.paymentCollections.refreshPaymentSession(payment_collection_id, session_id, payload)
|
||||
.then(({ payment_session }) => {
|
||||
console.log(payment_session.id);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
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.authorize(payment_id, session_id)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
Reference in New Issue
Block a user