# How to add pre-request script in bubble plugin

**URL:** <https://forum.bubble.io/t/how-to-add-pre-request-script-in-bubble-plugin/54021>\
**Category:** Plugins\
**Created:** [April 9, 2019, 1:45pm UTC](https://forum.bubble.io/t/how-to-add-pre-request-script-in-bubble-plugin/54021 "2019-04-09T13:45:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![himanshu.s](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/himanshu.s/32/46828_2.png) [@himanshu.s](https://forum.bubble.io/u/himanshu.s)\
**Post date:** [April 9, 2019, 1:45pm UTC](https://forum.bubble.io/t/how-to-add-pre-request-script-in-bubble-plugin/54021/1 "2019-04-09T13:45:59Z")

</div>

I am developing a bubble plugin for a payment gateway, but before running an API call there is a pre-request script that is executed , this script provides the Authorization header value.

But I am not understanding where should I put the script in the plugin editor and get value of the API Authorization header in the API section of the plugin editor.

---

<div class="post-metadata">

**Author:** ![eren](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eren/32/92848_2.png) [@eren](https://forum.bubble.io/u/eren)\
**Post date:** [April 12, 2019, 5:09pm UTC](https://forum.bubble.io/t/how-to-add-pre-request-script-in-bubble-plugin/54021/2 "2019-04-12T17:09:13Z")

</div>

Hi @himanshu.s

The answer from the Bubble team is below. I hope it helps

"Hi Eren,

Thanks for reaching out. Plugins have an object called ‘context’ with some Bubble utilities. For example context.async – call context.async with a function that kicks off an asynchronous operation, taking a callback taking (err, res). Returns res or else throws error. Would that way of doing a callback work for your use case?"

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [June 18, 2019, 1:46pm UTC](https://forum.bubble.io/t/how-to-add-pre-request-script-in-bubble-plugin/54021/3 "2019-06-18T13:46:00Z")

</div>

Closed on June 18, 2019, 1:46pm UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
