You can integrate a Chariz product with your own Cydia repo. There are two parts: redirecting Cydia to download from Chariz, and integrating the Buy Button in your depiction.

1. Redirect

Chariz’s package hosting automatically authenticates products using a paid-upfront model. APT does not support absolute URLs for the Filename: field of a package, so you must set up your server to redirect Chariz Pay-hosted product download requests to Chariz. You simply generate your repo (e.g. with dpkg-scanpackages as described by saurik’s documentation) and change the Filename: to a custom path that will tell your server to redirect to Chariz.

GitHub Pages warning

GitHub Pages does not support true HTTP redirects. GitHub’s documentation is misleading — the jekyll-redirect-from plugin creates HTML-based redirects. These will be understood by a web browser, but APT (Cydia) does not read HTML. If your repo is hosted on GitHub Pages, you will not be able to use the Cydia integration.

If you’re currently using GitHub Pages with a .github.io domain and would like to move to another host, you can follow GitHub’s steps to add a custom domain. Skip the step of setting your domain’s DNS to GitHub Pages — instead, set the DNS to the IP address provided by your new host. This will cause GitHub Pages to redirect your .github.io domain to your new website.

Setting up the redirect

These directions assume you’ll use paths like /chrpay/com.example.mypackage_1.0_iphoneos-arm.deb for Chariz downloads. You can change this to anything you’d like.

Apache

If you have access to configure Apache via .conf files, such as on a virtual private server (VPS), open the conf file for your site (e.g. /etc/apache2/sites-available/cydia.hbang.ws.conf). Otherwise, open the .htaccess file in the root of your site (often in a www or public_html folder), creating it if it doesn’t exist. Insert the following rule to create the redirect:

Redirect /chrpay https://chariz.io/download

If you edited the site conf file, this must go inside the <VirtualHost> … </VirtualHost> tags, and you must reload Apache so the change takes effect. (.htaccess changes are applied instantly without restart.)

apachectl -k graceful

If you get an error message during reload, mod_alias may not be enabled. You can enable it with the following commands:

a2enmod alias
apachectl -k restart
nginx

Open the nginx config file for your site (e.g. /etc/nginx/sites-available/cydia.hbang.ws or the main /etc/nginx/nginx.conf). Inside the server block, insert:

rewrite ^/chrpay/(.*)$ https://chariz.io/download/$1 last;

Then reload nginx with:

nginx -s reload

Configuring the Packages file

Now that the redirect is set up, you can edit your repo’s Packages file to change the filename fields to use the redirect path. For instance, if the section for your paid package looks like this:

Package: com.example.mypackage
Version: 1.0
Maintainer: Mr Example <example@example.com>
Architecture: iphoneos-arm
Size: 1234
MD5sum: d41d8cd98f00b204e9800998ecf8427e
SHA256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Filename: debs/com.example.mypackage_1.0_iphoneos-arm.deb

…change the filename to look like this:

Filename: chrpay/com.example.mypackage_1.0_iphoneos-arm.deb

Be careful to not upload your Chariz-hosted packages to your web server. The path could be easily guessed, and this would allow the package to be downloaded without passing through Chariz’s authentication system.

2. Buy Button

The Buy Button is a JavaScript-based widget that provides users with the ability to log into their Chariz account to buy the product, or link their device and download the product. Here is a live example for TypeStatus Plus:

The corresponding HTML for this example is:

<chariz-pay-buy-button item-id="typestatus-plus"></chariz-pay-buy-button>
<script src="https://chariz.io/js/buy-button.js" async></script>

It can also be viewed in the context of a live depiction by visiting cydia.hbang.ws.

The Buy Button will provide the appropriate interface for the device, operating system, and app (browser or Cydia).

Copy this code into your Cydia depiction page, changing typestatus-plus to the SKU identifier matching your product.

Template

If you don’t already have a system for creating depiction pages, you can copy this basic template:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>

	<style>
	body {
		font: 1em/1.3em -apple-system, system-ui, "Helvetica Neue", sans-serif;
		font: -apple-system-body;
	}
	</style>
</head>
<body>
	<chariz-pay-buy-button item-id="insert-your-sku-here"></chariz-pay-buy-button>
	<script src="https://chariz.io/js/buy-button.js" async></script>

	<p>This is a description for the package. This is a description for the package.
		This is a description for the package. This is a description for the package.
		This is a description for the package.</p>
	<p>This is a description for the package. This is a description for the package.
		This is a description for the package. This is a description for the package.
		This is a description for the package.</p>
</body>
</html>

Requirements

  • The website must be a secure origin (https://). The Buy Button will not load from an insecure origin. Consider using Let’s Encrypt or Cloudflare if your site currently isn’t secure. Make sure you configure your server to redirect http:// to https://.
  • The <chariz-pay-buy-button> tag must appear before the <script>, and the script should be set to load asynchronously.
  • The item-id must be set and should be confirmed to be valid. If the SKU is invalid, the Buy Button will not load.

The Buy Button script will throw errors in case of detected anomalies, which you can view using your browser’s JavaScript console.

Guidelines

  • Only place the Buy Button on the page used as your Cydia depiction. The page can be linked to from outside of Cydia (as we’ve done with the TypeStatus Plus link above), but should primarily be intended to be used from Cydia.
  • Place the Buy Button in a prominent place at the top of the page, before any body content. Users expect to see it near the top of the Details page in Cydia. Placing the Buy Button “below the fold” will confuse users.
  • Do not create a margin on the left or right sides of the Buy Button. It should span the entire width of the viewport inside Cydia.
  • Do not copy buy-button.js to your own server, or skip the JavaScript and directly load the Buy Button frame. If we make changes in future, your Buy Button could break! Using the official https://chariz.io/js/buy-button.js script guarantees it will always work.