Last active
August 28, 2019 01:43
-
-
Save leonkyr/a46665b0bef80f4912545949badffa0b to your computer and use it in GitHub Desktop.
stripe-connect-australia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.accounts.update(accountId, { | |
| metadata: { internal_id: "Tradie-2" }, | |
| tos_acceptance: { | |
| date: Math.floor(Date.now() / 1000), | |
| ip: "61.69.124.163" // Assumes you're not using a proxy | |
| } | |
| }).then(function (account) { | |
| console.log(JSON.stringify(account, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.charges.create({ | |
| amount: 2098, | |
| currency: "aud", | |
| source: "tok_mastercard_debit_transferSuccess", | |
| description: "Charge for Tradie 2 - Fix", | |
| receipt_email: "leo@gmail.io", | |
| on_behalf_of: accountId, | |
| }).then(function (charge) { | |
| // asynchronously called | |
| console.log(JSON.stringify(charge, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.charges.create({ | |
| amount: 2534, | |
| currency: "aud", | |
| source: "tok_mastercard_debit_transferSuccess", | |
| description: "Charge for Tradie 2 - Fix", | |
| receipt_email: "leo@gmail.io", | |
| transfer_data: { | |
| destination: accountId, | |
| }, | |
| }).then(function (charge) { | |
| // asynchronously called | |
| console.log(JSON.stringify(charge, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.charges.create({ | |
| amount: 3201, | |
| application_fee_amount: 299, | |
| currency: "aud", | |
| customer: customerId, | |
| // source: customerTokenId, // "tok_mastercard_debit_transferSuccess", | |
| description: "Charge for Tradie 2 - 1232", | |
| receipt_email: "leo@gmail.io", | |
| transfer_group: invoiceId, | |
| transfer_data: { | |
| destination: accountId, | |
| }, | |
| }).then(function (charge) { | |
| // asynchronously called | |
| console.log(JSON.stringify(charge, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.accounts.createPerson(accountId, | |
| { | |
| first_name: "Leo", | |
| last_name: "Tradie 2", | |
| email: "leo+tradie2@gmail.io", | |
| relationship: { | |
| account_opener: true, | |
| director: true, | |
| owner: true, | |
| title: "Director", | |
| }, | |
| }).then((person) => { | |
| console.log(JSON.stringify(person, null, 2)); | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Consider using a test number from https://stripe.com/docs/connect/testing#account-numbers | |
| stripe.accounts.createExternalAccount(accountId, | |
| { | |
| external_account: { | |
| currency: "aud", | |
| country: "au", | |
| object: "bank_account", | |
| account_holder_name: "Tradie 2", | |
| account_holder_type: "company", // "individual" | |
| routing_number: "110000", | |
| account_number: "000123456", | |
| }, | |
| }).then(function (bank_account) { | |
| console.log(JSON.stringify(bank_account, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.accounts.create({ | |
| country: 'AU', | |
| type: 'custom', | |
| business_type: 'company', | |
| // requested_capabilities: ['card_payments', 'transfers'], | |
| }).then(function (account) { | |
| console.log(JSON.stringify(account, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.customers.create({ | |
| email: 'paying.user@example.com', | |
| source: 'tok_mastercard', | |
| }).then((customer) => console.log(JSON.stringify(customer, null, 2))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.tokens.create({ customer: customerId }, { | |
| stripe_account: accountId, | |
| }).then(function (token) { | |
| console.log(JSON.stringify(token, null, 2)) | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.accounts.retrieve(accountId).then((account) => { | |
| console.log(JSON.stringify(account, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.balance.retrieve({ | |
| stripe_account: accountId | |
| }, function (err, balance) { | |
| console.log(JSON.stringify(balance, null, 2)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.transfers.create({ | |
| amount: 400, | |
| currency: "usd", | |
| destination: accountId, | |
| }, function (err, transfer) { | |
| if (err) { | |
| console.log(err); | |
| } else { | |
| console.log(JSON.stringify(transfer, null, 2)); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stripe.accounts.update(accountId, { | |
| settings: { | |
| payouts: { | |
| schedule: { | |
| interval: "manual", | |
| }, | |
| statement_descriptor: "Payout descriptor", | |
| }, | |
| }, | |
| }).then(function (account) { | |
| console.log(JSON.stringify(account, null, 2)); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment