-
Notifications
You must be signed in to change notification settings - Fork 50
Description
`import momo from "mtn-momo"
import { config } from "dotenv";
config()
const { Collections, Disbursements } = momo.create({
baseUrl: "https://sandbox.momodeveloper.mtn.com",
environment: "sandbox",
callbackHost: process.env.CALLBACK_HOST
});
const collections = Collections({
userSecret: process.env.USER_SECRET,
userId: process.env.USER_ID,
primaryKey: process.env.PRIMARY_KEY
});
// Request to pay
collections
.requestToPay({
amount: "50",
currency: "EUR",
externalId: "12345678",
payer: {
partyIdType: "MSISDN",
partyId: "250798205731"
},
payerMessage: "testing",
payeeNote: "hello"
})
.then(transactionId => {
console.log({ transactionId });
// Get transaction status
return collections.getTransaction(transactionId);
})
.then(transaction => {
console.log({ transaction });
// Get account balance
return collections.getBalance();
})
.then(accountBalance => console.log({ accountBalance }))
.catch(error => {
console.log(error.message);
});
`
No response for this
PS C:\Users\kwize\Projects\Dream-city\backend> node payments.js
{ transactionId: '90fab171-a8f9-4713-8283-1eacfbd3dcda' }
{
transaction: {
financialTransactionId: '1927264368',
externalId: '12345678',
amount: '50',
currency: 'EUR',
payer: { partyIdType: 'MSISDN', partyId: '250798205731' },
payerMessage: 'testing',
payeeNote: 'hello',
status: 'SUCCESSFUL'
}
}
Service temporarily unavailable, try again later.
PS C:\Users\kwize\Projects\Dream-city\backend>