Error on recurring charge when changing test flag to null

ya123
New Member
2 0 0

I followed this guideline to create a recurring charge on a public shopify app, but upon changing the test flag to null, and installing the app on a store I'm getting all sorts of errors including the screen that asks the merchants to approve fees/charges before proceeding not appearing at all. 

The snippet of the code that handles the payment is:

  def require_subscription
    unless ShopifyAPI::RecurringApplicationCharge.current
      @recurring_application_charge = ShopifyAPI::RecurringApplicationCharge.new(
        name: "Gift Basket Plan",
        price: 9.99,
        return_url: "https://my-app-domain.herokuapp.com/activatecharge",
        test: null,
        trial_days: 7,
        capped_amount: 100,
        terms: "$0.99 for every order created")
             
        if @recurring_application_charge.save
           redirect_to @recurring_application_charge.confirmation_url
        end
    end
  end
  
  def activatecharge
    recurring_application_charge = ShopifyAPI::RecurringApplicationCharge.find(request.params['charge_id'])
    recurring_application_charge.status == "accepted" ? recurring_application_charge.activate : (redirect_to root_path)
    redirect_to root_path
  end

 

When the test flag is set to true it works fine though

test: true

 

Anyone experienced this before or know what could be going wrong when the test flag is set to null?

The app is written in Ruby and is using API version 2019-10

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 163

Hey @ya123,

Can you provide a shop_id for a shop you've tried activating live charges on? As well, please provide a rough time frame for when you attempted to add these charges. I'll use this to check our logs for more information about the error.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
ya123
New Member
2 0 0

@_JB I sent you a private message with the details. If you need anything else please let me know

0 Likes