subpage C

  • Revision slug: User:Mark_Giffin/subpage_C
  • Revision title: subpage C
  • Revision id: 457885
  • Created:
  • Creator: MarkGiffin
  • Is current revision? No
  • Comment

Revision Content

[App payments guide]

There are two kinds of payments made by app end users in the Firefox Marketplace: a payment made to purchase an app (a paid app), and a payment made to buy something after the app is installed (an in-app payment). This page covers the flow for building and submitting apps that use both kinds of payments.

This page gives very simple ways to do these things. Keep in mind that there are many other ways to do it.

Building a paid app

Any app can be a paid app. It can be hosted or packaged, and it does not require special permissions. You can create a paid app simply by choosing to make it a paid app when you submit it to the Firefox Marketplace. However there are a few things that we recommend that you do to the app before submitting it. See the sections below.

Add installs_allowed_from

You should add the installs_allowed_from field to the app's manifest. Give it the URL of the Firefox Marketplace like this:

"installs_allowed_from": [ "https://marketplace.firefox.com" ]

This is needed as part of receipt validation so it can be determined if your app came from a store where it was paid for. You can add the URLs of other stores but this is all you need for now.

Verify the receipt

When an app is sold on the Marketplace, a digital receipt for the sale is created. You should code your app so that it verifies this sales receipt when it runs. This verification is not required but it is recommended. It will help avoid people installing your app without paying for it.

There is a Mozilla-maintained JavaScript helper library called receiptverifier that enables you to verify the receipt with a small amount of code. Include the following receiptverifier libraries in your app:

Then you can add the following code to your app (with text changes to match your app) to verify the receipt:

mozmarket.receipts.Prompter({
  storeURL: "https://marketplace.firefox.com/app/your-app",
  supportHTML: '<a href="mailto:you@yourapp.com">email you@yourapp.com</a>',
  verify: true
});

If you need to know more, here are some references on verifying receipts.

Submitting a Paid App to the Marketplace [INCOMPLETE]

Submitting an App to the Firefox Marketplace [link]
General instructions on submitting an app.
 
Marketplace Submission Video [link]
This video is a little out of date, but it shows the basic process of app submission. Two things that are missing for a paid app are choosing the Paid option and choosing a price.
 
 
 
 
 

Revision Source

<h2 id=".5BApp_payments_guide.5D">[App payments guide]</h2>
<p>There are two kinds of payments made by app end users in the Firefox Marketplace: a payment made to purchase an app (a paid app), and a payment made to buy something after the app is installed (an in-app payment). This page covers the flow for building and submitting apps that use both kinds of payments.</p>
<p>This page gives very simple ways to do these things. Keep in mind that there are many other ways to do it.</p>
<h2 id="Building_a_paid_app">Building a paid app</h2>
<div>
  <p>Any app can be a paid app. It can be hosted or packaged, and it does not require special permissions. You can create a paid app simply by choosing to make it a paid app when you submit it to the Firefox Marketplace. However there are a few things that we recommend that you do to the app before submitting it. See the sections below.</p>
  <h3 id="Add_installs_allowed_from">Add <code>installs_allowed_from</code></h3>
  <p>You should add the <code>installs_allowed_from</code> field to the app's manifest. Give it the URL of the Firefox Marketplace like this:</p>
  <pre>
<span class="brush: js" style="line-height: 1.572;">"installs_allowed_from": [ "https://marketplace.firefox.com" ]</span></pre>
</div>
<p>This is needed as part of receipt validation so it can be determined if your app came from a store where it was paid for.&nbsp;<span style="line-height: 1.572;">You can add the URLs of other stores but this is all you need for now.</span></p>
<h3 id="Verify_the_receipt">Verify the receipt</h3>
<p>When an app is sold on the Marketplace, a digital receipt for the sale is created. You should code your app so that it verifies this sales receipt when it runs. This verification is not required but it is recommended. It will help avoid people installing your app without paying for it.</p>
<p>There is a Mozilla-maintained JavaScript helper library called&nbsp;<a href="https://github.com/mozilla/receiptverifier" style="line-height: 1.572;" title="https://github.com/mozilla/receiptverifier">receiptverifier</a>&nbsp;that enables you to verify the receipt with a small amount of code.&nbsp;Include the following receiptverifier libraries in your app:</p>
<ul>
  <li><a href="https://github.com/mozilla/receiptverifier/blob/master/receiptverifier.js" style="line-height: 1.572;">receiptverifier.js</a></li>
  <li><a href="https://github.com/mozilla/receiptverifier/blob/master/receiptverifier-ui.js">receiptverifier-ui.js</a></li>
</ul>
<p>Then you can add the following code to your app (with text changes to match your app) to verify the receipt:</p>
<pre class="brush: js">
mozmarket.receipts.Prompter({
  storeURL: "https://marketplace.firefox.com/app/your-app",
  supportHTML: '&lt;a href="mailto:you@yourapp.com"&gt;email you@yourapp.com&lt;/a&gt;',
  verify: true
});</pre>
<h3 id="Paid_app_references">Paid app references</h3>
<p>If you need to know more, here are some references on verifying receipts.</p>
<ul>
  <li><a href="https://hacks.mozilla.org/2013/02/building-a-paid-app-for-firefox-os" title="https://hacks.mozilla.org/2013/02/building-a-paid-app-for-firefox-os">Building a Paid App for Firefox OS</a> - High-level overview of paid apps and has useful links for more information.</li>
  <li>
    <p><a href="/en-US/docs/Web/Apps/Publishing/Marketplace_Payments" title="/en-US/docs/Web/Apps/Publishing/Marketplace_Payments">Marketplace Payments</a> -&nbsp;Some information about paid apps. Also has in-app payment information.</p>
  </li>
  <li>
    <p><a href="/en-US/docs/Web/Apps/Publishing/Validating_a_receipt" title="/en-US/docs/Web/Apps/Publishing/Validating_a_receipt">Validating a Receipt</a>&nbsp;-&nbsp;Implementation details about verifying receipts.</p>
  </li>
  <li>
    <p><a href="https://github.com/mozilla/receiptverifier" title="https://github.com/mozilla/receiptverifier">receiptverifier</a> Library&nbsp;- The library used above.&nbsp;Has documentation on using it and includes an example of using it server side.</p>
  </li>
  <li>
    <p><a href="https://wiki.mozilla.org/Apps/WebApplicationReceipt" title="https://wiki.mozilla.org/Apps/WebApplicationReceipt">Web Application Receipt</a>&nbsp;-&nbsp;Detailed information on what a receipt is.</p>
  </li>
</ul>
<h2 id="Submitting_a_Paid_App_to_the_Marketplace_.5BINCOMPLETE.5D">Submitting a Paid App to the Marketplace [INCOMPLETE]</h2>
<div>
  Submitting an App to the Firefox Marketplace&nbsp;[link]</div>
<div>
  General instructions on submitting an app.</div>
<div>
  &nbsp;</div>
<div>
  Marketplace Submission Video&nbsp;[link]</div>
<div>
  This video is a little out of date, but it shows the basic process of app submission. Two things that are missing for a paid app are choosing the Paid option and choosing a price.</div>
<div>
  &nbsp;</div>
<div>
  &nbsp;</div>
<div>
  &nbsp;</div>
<div>
  &nbsp;</div>
<div>
  &nbsp;</div>
Revert to this revision