Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Stripe.StripeException: This customer has no attached payment source #5

Open
tatchou opened this issue Apr 27, 2015 · 3 comments
Open

Comments

@tatchou
Copy link

tatchou commented Apr 27, 2015

Hi guys,

Stripe.net: 2.9.0.0

On register process we got an error from the backend. This caused because we need to attach a credit card to the customer when creating it on Stripe.

public async Task CreateCustomerAsync(RevolustoreUser user, string planId = null, DateTime? trialEnd = null, string cardToken = null)
{
var customer = new StripeCustomerCreateOptions
{
AccountBalance = 0,
Email = user.Email
};

        if (!string.IsNullOrEmpty(cardToken))
        {
            customer.Card = new StripeCreditCardOptions
            {
                TokenId = cardToken
            };
        }

        if (!string.IsNullOrEmpty(planId))
        {
            customer.PlanId = planId;
            customer.TrialEnd = trialEnd;
        }

        var stripeUser = await Task.Run(() => _customerService.Create(customer));
        return stripeUser;
    }

The exception throw when we call _customerService.Create(customer).

Any answer.

@benfoster
Copy link

The issue is that you can't create a Subscription in Stripe if the Customer doesn't have a card (payment source) registered.

It works fine if you have set a trial period but if you wish for your customers to pay immediately on registration you'll need to build a payment form into your registration process.

@pedropaf
Copy link
Owner

pedropaf commented Jun 3, 2015

@tatchou did @benfoster advice fixed your issue?

@tatchou
Copy link
Author

tatchou commented Jun 3, 2015

Yes buddy thanks

-----Original Message-----
From: "Pedro Alonso" notifications@github.com
Sent: ‎2015-‎06-‎02 9:42 PM
To: "pedropaf/saas-ecom" saas-ecom@noreply.github.com
Cc: "tatchou" ayman.chafei@gmail.com
Subject: Re: [saas-ecom] Stripe.StripeException: This customer has no attachedpayment source (#5)

@tatchou did @benfoster advice fixed your issue?

Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants