With the Sources API, every customer had a default_source, but when using SetupIntent (in order to be compliant with the PSD2/SCA directive), there doesn't seem to be any direct equivalent.
So my question is, how this can be properly represented API-side (without using metadata)?
The payment_methods listing seems to have a property called preferred for the card (which seems to be what I am looking for), but so far I have not found out, how to get/set this property.
There is no direct equivalent to the default_source for Payment Methods and the newer APIs like Setup Intents and Payment Intents. The closest thing is invoice_settings.default_payment_method, but it only applies to Invoices.
To answer your question directly, you have three choices:
Set and use the value of invoice_settings.default_payment_method, specifying the Payment Method stored there explicitly for each Setup and Payment Intent
Specify the default Payment Method in metadata as you suggested
Stored the default on your end in your own database
Regarding the preferred property, if you're referring to card.networks.preferred that is the preferred card network of the card in question and is not relevant to your question.
If you use Webhooks, you can listen for payment_method.attached or setup_intent.succeeded events and set it as default when they are fired.
For more info:
https://stripe.com/docs/api/events/types
Payment method object can be set to update Customer invoice_settings property with a default payment method.
https://stripe.com/docs/api/customers/update#update_customer-invoice_settings
Related
The Square documentation for updating webhook events shows this URL format: PUT /v1/{location_id}/webhooks. However, creating a webhook event listener for every merchant location could be a lot of separate API requests, and it would be far easier to use the merchant_id instead of the location_id (even though this is not documented) and make one request for each merchant.
Attempting to do this actually works - when I PUT /v1/{merchant_id}/webhooks the webhook is saved in Square and transactions for any of that merchant's locations successfully send the webhook.
My question is, since this is undocumented (although it works) is it safe to rely on this approach?
While it may work currently, since it's undocumented, the behavior may change in the future and cause unintended side-effects. I strongly encourage you to follow the current documentation for subscribing to webhooks.
I saved my credit card in Stripe but why is it only in sources
And not under cards?
I have used stripe.customers.createSource as specified in the docs to save a card (https://stripe.com/docs/api#create_card)
I guess this is the reason why stripe.customers.listCards return nothing
The method stripe.customers.createSource in the library is just making a POST request to /v1/customers/cus_123/sources to add a source to it. The type of the source itself depends on what you have used to create it client-side.
If you create card Tokens client-side tok_123 you will get Card object card_123 on the customer. You could also get a Bank Account object if you use ACH debits in the US and created a bank account tokens btok_123. This is the legacy method that has existed for years in the API.
More recently, Stripe release a new high-level object called a Source and your can read more about Sources in the documentation. This allows you to have one unique object no matter the payment method used (card, SEPA debit, Alipay, Sofort, etc.). This makes handling the logic in your code a lot easier as the objects have the same shape and properties specific to each payment method live in a sub-hash that you know to handle differently. Those Source objects have an id in the format src_123.
Here, your customer has Sources attached to it. This means that client-side, when you collect the card details, you are actively creating a Source instead of a Token. This is due to the methods/calls you use to create it. In Elements you would be using createSource() instead of createToken() while in the mobile SDKs they would create Sources by default.
Ultimately, Sources are a better approach for a new integration as they are more scalable and can handle the growth of your business internationally in the future. I'd recommend keeping Sources moving forward.
The Stripe API has a source object that has a status field that tells you whether the payment instrument is chargeable or not.
However, in Stripe.net, all of the Source-related properties on the Customer object are of type StripeCard, which does not have any Status property. In fact, I can't see any way to retrieve a Source object in Stripe.net.
I'd like to be able to know whether a customer has a chargeable (not expired, etc) payment instrument hooked up to their account. How can I do this?
Also, does Stripe.net not allow manipulation of non-card payment instruments?
Stripe.net is a third-party library which means it wasn't built by Stripe. They haven't added support for Sources just yet which is why you're not seeing this. You can either make your own pull-request for this or report the issue on their github repo
Separately, though, you don't need to implement any of this at the moment. Cards and Bank Accounts are always chargeable by default. This status field is new and has been added for other sources such as Bitcoin Receivers but this isn't fully supported by Stripe officially just yet.
I would like to know if this is possible to add new payment method for Bigcommerce. I tried to contact their support without any luck. If anyone is familiar with bigcommerce and know if this is possible, i would appreciate any advice.
I already read their API docs and didn't found anything useful - only method to obtain list of available payment methods.
I already tried to signup for their partner. Without any luck.
We've done this before for a couple stores to allow clients to process payments through their own processor. The way we achieved this, is essentially through the following high-level steps:
Allow payments by Check (or similar offline method). We are going to replace this with the custom processor.
You'll notice that if you attempt to checkout via Check, that BigCommerce automatically creates the order for you, but sets the order status to Awaiting Payment. Upon submission the user is automatically sent to a 'Thank You' Order Confirmation page that contains both the Order ID and some payment instructions (such as where to send the check to).
Here's the trick -- Modify this 'Order Thank You' page to prompt the user for her or his credit card information. A simple HTML form will suffice here, performing the actual request via JavaScript.
Once you have the user's credit card data, you can then POST it to your own external server, where you would connect to and send data to whichever processor you are using. Additionally, you should make sure to send the Order ID to this program, so that you can connect to the BigCommerce API to load billing information, and then subsequently adjust the order status to either approved or declined depending on the response from your processor. Finally, you should send back some sort of response to the client to inform of the result of the charge attempt.
That's pretty much it in a nutshell. The way you integrate with the payment processor (step 4) is unique to whichever processor you are using. I hope this makes sense.
Although opinion based, I'm a huge fan of serverless technologies, and would suggest looking into AWS Lambda + AWS API Gateway. The benefit here is that you don't need to worry about creating an infrastructure or the associated concerns of security and scale. Rather, AWS Lambda allows you to simply upload your software, and allows it to be executed via an HTTP request to some defined endpoint set through the API Gateway. Lambda will scale automatically for you, and you don't need to worry about system level security concerns - only security at the application level. It's truly a set and forget setup, and a bleeding edge technology. Not to mention dirt cheap!
Implementing a new payment method is unsupported and requires hacky workarounds since we implement payment gateways via the core app. You can do this on blueprint by using an offline payment method and then using the API to update payment statuses, etc. I'd recommend using ActiveMerchant if you do wish to go down this path.
I am creating a Rails 3.2 application where I use Paymill to handle payments.
I can make one off payments using Active merchant. The problem with this is I cannot find a way to send the name of the buyer and the email address so the Paymill Client is incomplete. Also I would like to be able to create a Paymill subscription using Active merchant. Is this possible?
I know there is a Javascript version of the payment system and it works. Problem is I do not want to use Javascript, only ruby.
I have used this guide: How to make a payment via Paymill using Ruby
Thankful for all help!
Please, do NOT use Active Merchant if you don't have the proper PCI certifications. The Javascript version is the only way to use our service and profiting from our PCI compliance.
That being said, please take a look at the following paymill-ruby-wrapper, which has been provided by a third party developer - maybe it serves your purpose: https://github.com/dkd/paymill-ruby
Best regards,
Julian
(disclaimer: I work at PAYMILL)
Julian is right, you should not use ActiveMerchant except if you have the proper PCI certifications. It seems you want to do something like this:
1) Create a client object, passing the name (description) and email as parameters. See this: https://www.paymill.com/de-de/dokumentation/referenz/api-referenz/#create-new-client
2) Create a payment method object, passing the client as parameter (and the token retrieved by the JavaScript bridge): https://www.paymill.com/de-de/dokumentation/referenz/api-referenz/#create-new-credit-card-payment-with
3) Make a new transaction, passing the payment method object: https://www.paymill.com/de-de/dokumentation/referenz/api-referenz/#create-new-transaction-with
And to create a subscription, you need to have an offer object and a client with a valid payment method: https://www.paymill.com/de-de/dokumentation/referenz/api-referenz/#create-new-subscription