XF 2.3 Custom purchasable - Stripe error "You must specify either `product` or `product_data` when creating a price"

Sim

Well-known member
I'm trying to implement my own purchasable to allow members on one of my private sites to order photo prints.

I'm receiving the following error when I submit the purchase using the Stripe payment profile:
  • Stripe\Exception\InvalidRequestException: You must specify either product or product_data when creating a price.
  • src/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38
Code:
#0 src/vendor/stripe/stripe-php/lib/Exception/InvalidRequestException.php(35): Stripe\Exception\ApiErrorException::factory('You must specif...', 400, '{
  "error": {
...', Array, Object(Stripe\Util\CaseInsensitiveArray), NULL)
#1 src/vendor/stripe/stripe-php/lib/ApiRequestor.php(215): Stripe\Exception\InvalidRequestException::factory('You must specif...', 400, '{
  "error": {
...', Array, Object(Stripe\Util\CaseInsensitiveArray), NULL, NULL)
#2 src/vendor/stripe/stripe-php/lib/ApiRequestor.php(177): Stripe\ApiRequestor::_specificAPIError('{
  "error": {
...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array, Array)
#3 src/vendor/stripe/stripe-php/lib/ApiRequestor.php(562): Stripe\ApiRequestor->handleErrorResponse('{
  "error": {
...', 400, Object(Stripe\Util\CaseInsensitiveArray), Array)
#4 src/vendor/stripe/stripe-php/lib/ApiRequestor.php(124): Stripe\ApiRequestor->_interpretResponse('{
  "error": {
...', 400, Object(Stripe\Util\CaseInsensitiveArray))
#5 src/vendor/stripe/stripe-php/lib/ApiOperations/Request.php(80): Stripe\ApiRequestor->request('post', '/v1/checkout/se...', Array, Array)
#6 src/vendor/stripe/stripe-php/lib/ApiOperations/Create.php(25): Stripe\ApiResource::_staticRequest('post', '/v1/checkout/se...', Array, NULL)
#7 src/XF/Payment/Stripe.php(322): Stripe\Checkout\Session::create(Array)
#8 src/XF/Pub/Controller/PurchaseController.php(35): XF\Payment\Stripe->initiatePayment(Object(XF\Pub\Controller\PurchaseController), Object(XF\Entity\PurchaseRequest), Object(XF\Purchasable\Purchase))
#9 src/XF/Mvc/Dispatcher.php(362): XF\Pub\Controller\PurchaseController->actionIndex(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XF:Purchase', 'Index', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\PurchaseController), Object(XF\Mvc\Reply\Reroute))
#11 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\PurchaseController), Object(XF\Mvc\Reply\Reroute))
#12 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#14 src/XF.php(806): XF\App->run()
#15 index.php(23): XF::runApp('XF\\Pub\\App')
#16 {main}

... any suggestions?
 
ahh - seems you must supply a title for the purchasable for it to insert the product_data object ... I'm getting further now.
 
Back
Top Bottom