Stripe Connect API - How Do I Retrieve A Connected Account's Status? - stripe-payments

I am using Stripe Connect as a platform. On the Connected accounts page on the Stripe dashboard, there is a STATUS column.
How do I retrieve this information via the Connect API?
I am looking at the standard GET / retrieve endpoint for Connect accounts at https://stripe.com/docs/api/accounts/retrieve, but the response does not include an account status data point.

There's no status field on the account object. Those statuses are likely inferred by looking at whether an account has charges and payouts enabled.

I too faced this problem. I came to understand that we have to check it manually from our side. You can check the status by using below conditions:
Account account = Account.retrieve("ACC_ID");
if(account.getRequirements().getPastDue() != null || account.getRequirements().getCurrentlyDue() != null){
//RESTRICTED
}
else if(!account.getPayoutsEnabled() ){
//PENDING
}
else
//COMPLETED
You can also check whether transfer and card payment are active or not from Capabilities object.

Related

Monetization Strip Account key Error in WSO2 APIM V4.1.0

I tried to use the stripe connected ID to APIM monetization. It is shows like this. How can I resolve this?
[2022-12-13 09:07:53,293] ERROR - ApisApiServiceImpl Error while changing monetization status for API ID : 44561b93-cd44-4959-877e-ddf2ff3170a9
org.wso2.carbon.apimgt.api.MonetizationException: Stripe key of the connected account is empty.
You have to provide the account id of the connected account which starts as acct_*** while monetizing the API at image 1. The above account Id can be found under connect section of the Stripes platform or parent account.

How to prevent creating duplicate subscription in stripe when trial period is set on subscription

I am encoutering a problem with stripe. let me explain my working
scenario.my requirement is do not charge user for 14 days with card up front
1)user enter card details
2)sca popup appear
3)regardless of user complete the authentication or not a subscription is created in stripe because i set trial_end_date=>now()+14 days
4)user payment fails in some reason and attempt again, another subscription created
i am worried about the duplicate subscription as the stripe will attempt to pay after the 14 days for both of these subscription as it send a Stripe-hosted link for cardholders for both of these subscription
let me give a snapshot of what i have so far
$data['customer']='customerId';
$data['items']=[];
$data['items'][0]['plan']='stripe_plan_id'
$data['default_payment_method']='pm_xxxx'
$data['trial_end']= strtotime('+14 days');
$data['prorate']=true;
$data['tax_percent']=env('VAT_PERCENTAGE');
$data['expand']= ['latest_invoice.payment_intent', 'pending_setup_intent'];
try {
$subscription=\Stripe\Subscription::create($data);
}
catch(Exception $e) {
return response()->json(['success' => false,'message'=>$e->getMessage()]);
}
what i am missing? how to prevent the duplicate subscription scenario.please expain with the correct example which is i am missing.thanks in advance
I think the problem is in your payment flow, there is not a stripe api that explicitly detects duplicate subscription. You are after all allowed to assign more then 1 subscription per customer id. You can create idempotent keys, but that isn't for the same thing you're talking about, idempotent keys are for accidently hitting the submit button twice within the same timeframe.
The solution would be to attach a payment method to your stripe customer id before your subscription trial is over. For example if you are using stripe elements you would call
Node/JS Example below :
const result = await stripe.createPaymentMethod({
type: 'card',
card: card
})
then pass that result to your backend
const result = await stripe.paymentMethods.attach(paymentMethodId, {customerId})
You do not need to create a new subscription, as one has already been created for that user. Credit cards are assigned to customer Ids, and not to subscriptions. Stripe will do the rest.
You do also need to update the customer with the default payment method as follows :
const customer_update = await stripe.customers.update(stripeCustomerId,{invoice_settings: {default_payment_method:paymentMethodId}});
Now when you visit your dashboard you will see a default card assigned to your customer. Once the subscriptions falls out of the trail period, the default card will be charged.
So in this case there wont be a duplicate subscription created, as you are not calling stripe.subscriptions.create again.

How to implement Paypal subscription in a vue application?

I am working on a project which needs to deducts a fixed amount from a user's account to a business account on monthly basis. I am trying to create a Paypal button client side (vue) for accepting subscriptions on monthly basis. The users deduction information on monthly basis shall be stored in a database. The user shall also provided an option to cancel the subscription. Any help would be greatly appreciated.
Well i found out an answer after a little digging in the documentation provided at https://developer.paypal.com/docs/subscriptions/integrate and went through the steps they provided.
Steps
Create a product through their API by providing access_token in the headers.
After the product has been created, get product-Id from response and then create plan using the product_id in request body.
After the plan has been successfully created copy Plan_id and replace the id in smart subscription button.
paypal.Buttons({
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'P-your_plan_id'
});
onApprove: function(data, actions) {
alert('You have successfully created subscription ' + data.subscriptionID);
}
}

Access the DocuSign API in your Force.com / Salesforce.com account in order to send an object with a single click of a button

DocuSignAPI for Salesforce.
Hello everybody, I'm following this manual to access the DocuSign API in Force.com / Salesforce.com account in order to send an object with a single click of a button to be isgned.
http://developer.force.com/cookbook/recipe/accessing-docusign-api-from-salesforcecom-to-send-contracts-for-esignatures
the problems is when i get the next error:
"The DocuSign EnvelopeId:Exception - System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: The email address for the recipient is invalid. The recipient Id follows. faultcode=soap:Client faultactor=https://demo.docusign.net/api/3.0/dsapi.asmx"
Do anyone know the solution?
Thank you.
Re your specific error, I suggest that you download the API call logging information from DocuSign itself to see exactly what you sent to DocuSign via Salesforce.
In general for Salesforce/DocuSign integration, recommended first step is to use DocuSign for Salesforce, available from the Salesforce app store.
Additional developer information and source code is available from this blog post. It includes info on recipes (including source code) from DocuSign that document how to call the DocuSign API from Salesforce.
One issue to watch out for: you can't send PDFs from Salesforce to DocuSign due to callout limitations enforced by Salesforce.
Solutions:
you can make a call to a gateway (which you write). Your gateway would then pull the doc from Salesforce and then send it to DocuSign
Or use DocuSign for Salesforce which does the above for you.
thank you for your answer.
At the end the solution was that the email of the person that I wanted to send the document to sign didnt exist :P.
But now my problem is How can I update the Docusign status? becouse when I put this in an "execute anonymous windows" that creates me a Status:
dsfs__DocuSign_Status__c status = new dsfs__DocuSign_Status__c();
status.dsfs__Contract__c='0293900000xD';
status.dsfs__Envelope_Status__c='Sent';
upsert status;
but when i use this inside of a controller extension:
try {
DocuSignAPI.EnvelopeStatus es = dsApiSend.CreateAndSendEnvelope(envelope);
envelopeId = es.EnvelopeID;
// this.contract.DocuSign_Status__c=es.Status;
dsfs__DocuSign_Status__c status = new dsfs__DocuSign_Status__c();
status.dsfs__Contract__c=this.contract.Id;
status.dsfs__Envelope_Status__c=es.Status;
upsert status;
} catch ( CalloutException e) {
System.debug('Exception - ' + e );
envelopeId = 'Exception - ' + e;
}
Doesn't work, the Status is never created.
Thank you for your help.

In the Authorizenet SDK version 1.1.8 for PHP Is there a way to charge a card using a customer payment profile?

I have been up and down through the SDK code and have the ability to add customer profiles and payment profiles for them but I can't see anywhere, where I can charge a card or create a subscription from a customer profile and customer payment profile. Does anyone have an answer for this for either the create subscription, or charge a card, using the PHP SDK. Please understand, giving me an interactive web example using AuthorizeNet's web API is not helpful here. The requirements are that it has to be done through the PHP SDK as we cannot have card user interaction past the point of the customer profile and customer payment profile creation.
First off need to define the normal credentials used for SDK requests
if (!defined("AUTHORIZENET_API_LOGIN_ID")) define("AUTHORIZENET_API_LOGIN_ID", {authorizenet_api_login_id};
if (!defined("AUTHORIZENET_TRANSACTION_KEY")) define("AUTHORIZENET_TRANSACTION_KEY", {authorizenet_transaction_key};
Then create the transaction and set the fields.
$transaction = new AuthorizeNetTransaction;
$transaction->amount = $amount;
$transaction->customerProfileId = $customerProfileId;
$transaction->customerPaymentProfileId = $customerPaymentProfileId;
// next line may be optional depending on your situation
$transaction->customerShippingAddressId = $customerShippingAddressId;
Then process the transaction
$request = new AuthorizeNetCIM;
$response = $request->createCustomerProfileTransaction("AuthCapture", $transaction);
if ($response->xml->messages->resultCode=="Ok") echo "It Was Approved"
;

Resources