OSSPhilippines / paymongo

A lightweight Node.js client for Paymongo API
https://paymongo.ossph.org/
MIT License
88 stars 24 forks source link

Catchup with latest API updates #10

Closed jofftiquez closed 4 years ago

jofftiquez commented 4 years ago

Refer to next version

jofftiquez commented 4 years ago

Hello! Thank you for submitting an issue.

ccfiel commented 4 years ago

@jofftiquez when will this feature available? :)

jofftiquez commented 4 years ago

@ccfiel now that there's someone interested I might expedite the ETA. I thinking, tomorrow, in-time for Easter Sunday. :)

ccfiel commented 4 years ago

@jofftiquez wow! thanks for the update! :)

jofftiquez commented 4 years ago

Hello @ccfiel the latest updates are now available in this branch feat/next.

Tests are all passing. I will merge this soon today as soon the docs are done.

There has been some major changes in the syntax of using the paymongo instance. I decided to mimic the Stripe's node.js library pattern. E.g. stripe.subscriptions.create()

Altho the docs are not yet completed, you can test the build in the ./dist folder. For your convenience here are all the available available methods.

const paymongo = new Paymongo(process.env.secret);

// Payment Methods
paymongo.paymentMethods.create(data);
paymongo.paymentMethods.retrieve(id);

// Payment Intents
paymongo.paymentIntents.create(data);
paymongo.paymentIntents.retrieve(id);
paymongo.paymentIntents.attach(id, data);

// Sources
paymongo.sources.create(data);

// Payments
paymongo.payments.create(data);
paymongo.payments.retrieve(id);
paymongo.payments.list();

// Tokens (DEPRECATED)
paymongo.tokens.create(data);
paymongo.tokens.retrieve(id);

// Webhooks
paymongo.webhooks.create(data);
paymongo.webhooks.retrieve(id);
paymongo.webhooks.list();
paymongo.webhooks.toggle(id, action); // action = 'enable' or 'disable'
ccfiel commented 4 years ago

@jofftiquez wow that was fast! thanks! I will test it

jofftiquez commented 4 years ago

@ccfiel btw it's already release try v1.0.0

ccfiel commented 4 years ago

Thanks! 😀