payjp / payjp-node

PAY.JP server-side JavaScript & Typescirpt SDK :tada: (Note. will remove npm beta tag) Tutorial:
https://pay.jp/docs/started
MIT License
33 stars 8 forks source link

add statement & fix tenant.payjp_fee_included #49

Closed darai0512 closed 1 year ago

darai0512 commented 1 year ago

Check script

$cat sample.js
const Payjp = require('./built')
const payjp = Payjp('sk_test_xxx', {
  apibase: 'http://yyy/v1'
});

payjp.statements.list().then(async (statements) => {
  console.log(statements.count)
  for (const s of statements.data) {
    try {
      const res = await payjp.statements.statementUrls(s.id, {platformer: true})
      console.log(res)
    } catch (e) {
      console.error(e.status)
    }
  }
}).catch(console.error)

payjp.tenant_transfers.list().then(async (tts) => {
  console.log(tts.count)
  for (const tt of tts.data) {
    try {
      const res = await payjp.tenant_transfers.statementUrls(tt.id, {platformer: true})
      console.log(res)
    } catch (e) {
      console.error(e.status)
    }
  }
}).catch(console.error)

$node sample.js
404 <- statement nothing
{
  expires: 1699433619,
  object: 'statement_url',
  url: 'https://pay.jp/_/statements/hogehoge'
}