How to supply name and email to Paymill payment - activemerchant

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

Related

Best way to handle one-time payments with STRIPE webhooks in nodeJS

I am using STRIPE as my payment processor, in an REACT + nodeJS app. I already have something that already works, but I would like some feedback, maybe I'm doing something wrong.
So... I have this Redirect-To-Checkout functionality thats made available by STRIPE, basically I redirect the user to this STRIPE page where all card-data (sensitive information) is processes in order for the payment to full-fill.
What I do in my nodeJS server part is the following:
Once the user acces the redirect to check-out page, I already create a PendingOrder, with the products selected by client (Here I save some information based on client/stripe payment-intent, in order to check in later steps)
Once webhook gives me the 'payment_intent.succeeded' I check for the payment-intent information to see if it exists in my PendingOrder collection, then proceed to add in to ConfirmedOrders and remove it from PendingOrders.
I have to do this whole process because Stripe no longer gives me access to some information I require when the user is checking-out his order(such as observation that the user has based on the type of service he chooses).
Are there any down-sides to this approach or is there any other way to do it?
Thanks in advance!
You’re not really far from the best practices that Stripe recommends here. The only thing that I would change is listening to checkout.session.completed instead of the payment_intent.succeeded event. As of the latest API version, a PaymentIntent is no longer created upfront so a better to way to handle order fulfillment is to either store the Checkout Session ID (e.g. cs_live_xxx) or you could add some metadata when creating the Checkout Session and use that instead to identify the order.
I have to do this whole process because Stripe no longer gives me access to some information I require when the user is checking-out his order
As for this, I’m not sure what you mean, you can always use your app with the success page customization described here alongside webhooks. I wouldn’t use that to fulfill the order though since the user might close the page before the redirection completes which means that the fulfillment wouldn’t be done in that case. As such, webhooks are essential to order fulfillment.

Why is saved stripe card only in sources and not cards?

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.

Can we use custom UI for STRIPE

I implemented stripe with the default interface which is all fine.
But now my client wants to use his custom screen to input payment information like this
They just want to not use STRIPE's default UI
I have be searching about it but could not find about it. Is this possible?
Please guide.
Thanks in advance
You can use the https://stripe.com/docs/stripe-js method with Elements to achieve this. In addition, you can create your own custom HTML form with whatever data you want (metadata in the customers API) and use it that way.
To learn how to create charges: https://stripe.com/docs/api#charges
To learn how to create customers: https://stripe.com/docs/api#customers

Creating new payment method for Bigcommerce

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.

Stripe for one time payment. - Ruby on Rails

Can I use Stripe for receiving a one-time payment instead of recurring payments?
If so what settings do I have to make?
Yes, just use the Stripe::Charge.create method. As the payment method, you can either pass in a card directly or reference a Customer whose card should be charged.
You can receive one-time payments via the Stripe dashboard. Go to:
https://dashboard.stripe.com/payments
and click the button for a "+New" payment. That will let you manually enter the cc info. I do this with my Pairing as a Service clients all the time... they just read me their card info, and I enter it with the amount I'm charging them and a description. Your account password is then required to complete the charge.
It's fast and easy... I just wish there was a way to let them enter the info directly. Maybe I'll make something like that...
Yes, You can just create a Stripe account and use a simple example of Stripe payment for Ruby on Rails I've made recently. Check the code: https://github.com/ab00zar/StripePayment-example
Run the server using your test keys like:
PUBLISHABLE_KEY=pk_test_g0XSu8r2ugAETksVJQXJjU30
SECRET_KEY=sk_test_A3rwGLOMNxEKDkaJOTgi4frd rails s

Resources