title: Paystack Subscription with Google Cloud Functions
body: <p>I'm tryng to inteegrate Paystack subscription based payment in to a react app using firebase and google cloud functions. I added the the node, from the paystack documentation, code to my cloud function. Once i run the code i get en error ReferenceError: resp is not defined.</p>
  <p>Paystack doc for reference <a href="https://paystack.com/docs/payments/subscriptions/#create-a-subscription" rel="nofollow noreferrer">https://paystack.com/docs/payments/subscriptions/#create-a-subscription</a></p>
  <pre class="lang-js prettyprint-override"><code>exports.payment = functions.https.onCall((data) =&gt; {
      const params = JSON.stringify({
        &quot;email&quot;: &quot;customer@email.com&quot;,
        &quot;plan&quot;: &quot;PLN_xxxxxxxxx&quot;
      })
      const options = {
        hostname: 'api.paystack.co',
        port: 443,
        path: '/transaction/initialize',
        method: 'POST',
        headers: {
          Authorization: 'Bearer SECRET_KEY',
          'Content-Type': 'application/json'
        }
      }
      const req = https.request(options, res =&gt; {
        let data = ''
        resp.on('data', (chunk) =&gt; {
          data += chunk
        });
        resp.on('end', () =&gt; {
          console.log(JSON.parse(data))
        })
      }).on('error', error =&gt; {
        console.error(error)
      })
      req.write(params)
      req.end()
  })
  
  </code></pre>
  <p>Thanks</p>