Closed reillychase closed 5 years ago
There's the createAsStripeCustomer
method on the Billable
entity which accepts an $options
parameter and the create
method on the SubscriptionBuilder
als accepts an $options
array where you can pass the metadata.
I am working on integrating getRewardful affiliate program with Laravel Spark.
The way it works is you add Javascript to layouts/app.blade.php for example to check for a referral cookie. If found it injects a field into the register form on /register.
On the backend I am checking for that being submitted in /src/Interactions/SubscribeTeam.php
Then I need to take it and add it to a metadata 'referral' field when creating the customer (with Cashier's newSubscription function).
If I do ->withMetadata, it adds the referral to the Stripe subscription, but it needs to be added to the Stripe customer.
After looking into this, there appears to be no way to add metadata to the customer instead of the subscription in Cashier, so I have to hack my own API call instead.