Check ACH credit transfer for customer in stripe using java - stripe-payments

Is there any way to check whether ACH credit transfer added to customer or not in stripe using java with using only customerid.

ACH Credit Transfer is still only available on Stripe's legacy API called the Source API as documented here. Since it is not yet compatible with the PaymentMethod API you have to use one of the old calls in Java called getSources() which can be a bit hard to discover.
Your code would look something like this:
// Retrieve the customer with its legacy payment sources included
CustomerRetrieveParams retrieveParams =
CustomerRetrieveParams.builder()
.addExpand("sources")
.build();
Customer customer = Customer.retrieve("cus_1234", retrieveParams, null);
// Filter payment sources down to just Sources
PaymentSourceCollectionListParams sourcesParams =
PaymentSourceCollectionListParams.builder()
.setObject("source")
.build();
PaymentSourceCollection sources = customer.getSources().list(sourcesParams);
// Iterate over the Sources to find what you need
Iterable<PaymentSource> itSources = sources.autoPagingIterable();
for (PaymentSource paymentSource : itSources) {
Source source = (Source) paymentSource;
System.out.println(source.getId());
System.out.println(source.getType());
}
System.out.println("done");

Related

Using Stripe/Apple Pay, how to request an email-receipt for successful payments in the app

Using Stripe/iOS, the user of the app can pay by credit card or by Apple Pay.
I want, from the app (not the server), to request an email receipt when payment is successful.
For Credit Card payment I do the following:
let paymentIntentParams = STPPaymentIntentParams(clientSecret: <paymentIntentClientSecret>)
paymentIntentParams.paymentMethodParams = paymentMethodParams
if let receiptEmail = self.receiptEmail {
paymentIntentParams.receiptEmail = <email address>
}
let paymentHandler = STPPaymentHandler.shared()
paymentHandler.confirmPayment(withParams: paymentIntentParams,
authenticationContext: authenticationContext) {
…
}
However for Apple Pay payment I don’t know which property to set. In the app, I implement the STPApplePayContextDelegate protocol.
Question: For Apple Pay payment, what and where I need to set the email-address for the receipt? Can you please provide a code snippet?
Thanks
After discussion with Stripe support, it seems that using STPApplePayContextDelegate there is no way to set the receiptEmail property in the payment intent.
The best approach is to change the server and set the receiptEmail at
the server
If you still want to make the change at the app, the workaround is to use the REST API to update the payment intent.
Below is the reply from Stripe support:
The STPApplePayContext does not support this directly -- it needs to be set on the payment intent. The iOS flow for card payments is described in [0] and support receiptEmail in the STPPaymentIntentParams [1], but the Apple Pay flow is different. If not set when you create the payment intent, you would then want to make a call to your server to update the payment intent [2] in the payment flow where you call the completion. Alternately, confirm the payment intent server-side after collecting the Apple Pay payment method client-side [3].
[0] https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=custom#ios-submit-payment
[1] https://stripe.dev/stripe-ios/docs/Classes/STPPaymentIntentParams.html#/c:#M#Stripe#objc(cs)STPPaymentIntentParams(py)receiptEmail
[2] https://stripe.com/docs/api/payment_intents/update#update_payment_intent-receipt_email
[3] https://stripe.com/docs/apple-pay?platform=ios#client-side

How to use ACH payments in North America with stripe payment Intents

attempting to use a payment method of a ACH payment...but I can't figure out how to do it. Theoretically the documentation here says I can.
https://stripe.com/payments/payment-methods-guide#for-professional-services
However when I go here:
https://stripe.com/docs/api/payment_methods/create#create_payment_method-type
I see 'card' listed, but I do not see anything related to 'bank' or 'ach' or 'check' so I am confused.
I have no issues following their instructions to manually create a "bank" object programmatically, and then making then making that bank object a "source" as shown here:
const bank_submit_object = {
"object": 'bank_account',
"country": 'US',
"currency": 'usd',
"routing_number": routing_number,
"account_number": account_number,
"account_holder_name": account_name,
"account_holder_type": account_type
}
const bankAccount = await stripe.customers.createSource(
'customer_id',
{ source: bank_submit_object }
);
My problem is sources is listed as an Older api
https://stripe.com/docs/sources
And previously to today (the warnings are gone today for some reason), the documentation would flash a warning saying sources are the old way of doing things and to stop doing it.
So in order to do things the new way, can somebody help suggest how to do ACH payments using payment methods and NOT sources.
Thanks guys.
This is not supported by the current public API. For payments using ACH today, you should follow this guide using the legacy Charges API.
Note the callout at the top mentioning a beta for ACH payments using Payment Intents. If you're interested in that, you should fill out the linked form.
Edit 2022: The new Payment Methods & Payment Intents API support for ACH direct debit has since been released. See here: https://stripe.com/docs/payments/ach-debit

Deep Insert on Business Partner via SAP Cloud SDK VDM doesn't work on to_Customer

I'm trying to create a business partner including a customer, a customer sales area and a customer company with the SAP Cloud SDK.
This is how I create my business partner vdm:
final CustomerSalesArea customerSalesArea = CustomerSalesArea.builder()
.salesOrganization("YOD1")
.distributionChannel("Y2")
.division("Z1")
.currency("EUR")
.customerAccountAssignmentGroup("01")
.customerPaymentTerms("0001")
.customerPricingProcedure("Y1")
.incotermsClassification("FH")
.itemOrderProbabilityInPercent("100")
.orderCombinationIsAllowed(true)
.customerAccountGroup("CUST")
.build();
final CustomerCompany company = CustomerCompany.builder()
.companyCode("YOD1")
.reconciliationAccount("0012100000")
.customerAccountGroup("CUST")
.build();
final Customer customer = Customer.builder()
.customerSalesArea(customerSalesArea)
.customerCompany(company)
.build();
final BusinessPartner businessPartner = BusinessPartner.builder()
.firstName(oxidBusinessPartner.getFirstName())
.middleName(oxidBusinessPartner.getMiddleName())
.lastName(oxidBusinessPartner.getLastName())
.businessPartnerCategory("1")
.correspondenceLanguage("DE")
.businessPartnerIDByExtSystem(oxidBusinessPartner.getCustomerId())
.customer(customer)
.build();
final BusinessPartnerRole businessPartnerRole1 = BusinessPartnerRole.builder()
.businessPartnerRole("FLCU00")
.build();
final BusinessPartnerRole businessPartnerRole2 = BusinessPartnerRole.builder()
.businessPartnerRole("FLCU01")
.build();
businessPartner.addBusinessPartnerRole(businessPartnerRole1);
businessPartner.addBusinessPartnerRole(businessPartnerRole2);
final AddressEmailAddress emailAddress = AddressEmailAddress.builder()
.emailAddress(oxidBusinessPartner.getEmail())
.build();
for (PostalAddress address : oxidBusinessPartner.getPostalAddresses()) {
final BusinessPartnerAddress businessPartnerAddress = BusinessPartnerAddress.builder()
.country(address.getCountry())
.cityName(address.getCity())
.postalCode(address.getZipCode())
.county(address.getRegion())
.emailAddress(emailAddress)
.build();
businessPartner.addBusinessPartnerAddress(businessPartnerAddress);
}
Now, I am able to successfully create this business partner with the DefaultBusinessPartnerService. However the actual deep insert doesn't seem to work properly as the Customer is not created.
I can confirm this by querying the A_BusinessPartner API with an expand to to_Customer, which returns null. The deep insert on the BusinessPartnerRole however worked as expected.
So, what am I missing here? Is there some sort of dependency, such as that I first need to create a BusinessPartner and then a Customer (I am by no means an expert in S4/HANA)? But then again, the SAP Cloud SDK doesn't provide a method to create a Customer and neither does api.sap.com.
Unfortunately it's not possible to create instances of Customer entity when using the Business Partner API. In the official documentation you will find only support for "Reading" and "Updating" Customers. I looked for an alternative Rest service in the SAP API Business Hub and found the Customer Master service, with limited functionality though. Maybe it allows the creation of Customers.
If I leave the customer "empty", so if I just do
Customer customer = Customer.builder().build(); and attach it to the Business Partner, the Customer entity is somehow created. I then use the OData Servives /A_CustomerCompany and /A_CustomerSalesArea to create those entities respectively and everything works as expected.

Stripe recurring payments for 3DS source

I want to use Stripe to charge cards recurrently every 30 days with amounts that oscilate.
From the docs I got that if there is a possibility that the card requires 3DS we should use Sources so I switched to sources ;)
From the source object stripe.js retrieves I look at three_d_secure param to decide whether to create a source object that requires 3DS or a normal card charging.
The flow:
With JS I get the source object that has three_d_secure set to either optional or required.
When it's set to optional after I retrieve the source with: source = Stripe::Source.retrieve(source_id) it looks like this:
"status": "chargeable",
"type": "card",
"usage": "reusable",
"card":{"exp_month":12,"exp_year":2032,"brand":"Visa",...
I attach it to a customer and charge it. I guess usage: reusable means that I can charge the card again later...
When three_d_secure=='required' I create a new source calling this:
source = Stripe::Source.create({
amount: amount,
currency: currency,
type: 'three_d_secure',
three_d_secure: {
card: source_id, #src_xcvxcvxcvc
},
redirect: {
return_url: return_url
},
})
I redirect the user to the URL Stripe provides, user enters his 3DS PIN and gets back to my return_url. When Stripe redirects the user back to my return_url I retrieve the source again and get something like this:
"status": "chargeable",
"type": "three_d_secure",
"usage": "single_use",
"three_d_secure": {"card":"src_1B1JzQHopXUl9h9Iwk05JV1z","authenticated":true,"customer":null}
I would expect that after passing the 3DS the source becomes reusable and chargeable until the date of expiry or so :|
My questions are:
1 Why is the 3DS source single_use? Is this like this only in sanbox environment or with the card I am using to test?
2 Can a 3DS protected card be charged again at all?
3 What's the correct approach to attach to customer sources (3DS or normal) that can be charged again and again?
Thank you!
Because it is a source payment token, not a source card token. It expires on a due date or when is consumed. You can use reusable token to create single_use tokens. reusable one represents a card source token
Yes if a 3ds is optional or not_supported, no if required. If required then every payement needs to fulfill a 3ds.
Steps:
Create an src_card_token for a card or use saved one (reusable)
Create an customer object with an src from src_card_token
Create an src_payment_token for a customer using one of his saved cards (as token)
fullfil a 3ds redirect process if required.
create a charge

Invoice number in create_with_paypal node sdk PayPal

I'm using Create PayPal SDK to make a transaction using paypal and redirecting the user to paypal.
I'm using the same code as per suggested in above link, but i want to send invoice number with create paypal to be shown under transaction detail. but i am not able to find how can i send a invoice number to paypal.
Please guide me if there is any object in which i can sent the invoice number to Create PayPal SDK OR any other method through which i can sent invoice number to PayPal.
Note: this project is in sailsjs.
Thanks
Please check this: https://github.com/paypal/PayPal-node-SDK/blob/master/samples/invoice/send.js
var invoiceId = "INV2-GLJ8-9FA2-26BB-GHLU";
paypal.invoice.send(invoiceId, function (error, rv) {
if (error) {
console.log(error.response);
throw error;
} else {
console.log("Send Invoice Response");
console.log(rv);
}
});
Please look at the complete invoice example here, there is everything you need: https://github.com/paypal/PayPal-node-SDK/tree/master/samples/invoice
As per documentation you can handle your custom IDs:
For exploring additional payment capabilites, such as handling
discounts, insurance, soft_descriptor and invoice_number, have a look
at this example. These bring REST payment functionality closer to
parity with older Merchant APIs. https://github.com/paypal/PayPal-node-SDK

Resources